|
Post by rreynier on Feb 19, 2019 18:13:45 GMT
As title states: any way to get a list of items in a directory?
|
|
|
Post by rreynier on Feb 19, 2019 18:18:48 GMT
As a side-note, io.popen doesn't seem to "supported"
|
|
|
Post by AnkuLua on Feb 20, 2019 7:15:54 GMT
As title states: any way to get a list of items in a directory? Try this function scandir(directory)
local listFile = scriptPath() .. "__list" local command = "ls " .. directory .. " > " .. listFile os.execute(command)
local lines = {} local i = 1 for line in io.lines(listFile) do lines[#lines + 1] = line end
os.execute("rm " .. listFile) return lines end
BTW, io.open is supported For example fPointer = io.open(fileName, "a+") dofile(fileName)
|
|