M MY Multiplayer: Wiki
Side
Kind

pathListDir

Shared

Lists what a folder holds.

table|false pathListDir(string path)

Parameters

NameTypeDescription
pathstringA path inside the calling resource, or @resource/path for another resource's file.

Returns

The names in alphabetical order, folders ending in /, or false if the folder does not exist or could not be read.

A path may not contain .., \ or :, nor start with /. Another resource's files can only be read; an invalid path logs a warning and the function returns false.

Example

for _, name in ipairs(pathListDir("maps") or {}) do
    if name:sub(-1) ~= "/" then
        print("map file: " .. name)
    end
end

See also