However, it does seem to be listing the files and directories correctly.
Code:
Spoiler
Posted 28 June 2016 - 06:54 AM
Posted 28 June 2016 - 08:50 AM
-- Test file lister local tFsList = fs.list("/") local tDirList = {} local tFileList = {} --#local i = 1 for i, file in ipairs(tFsList) do --for i=1, #tFsList, 1 do print(file) if fs.isDir(file) then table.insert(tDirList, file) else table.insert(tFileList, file) end end print("Files:") --#local i = 1 for i=1, #tFileList do print(tFileList[i]) end print("Directories:") --#local i = 1 You also don't need to make a variable here, it will get created in the for loop for i=1, #tDirList do --#print(tFileList[i]) <-- Was this print(tDirList[i]) --# <-- Now this end
Posted 29 June 2016 - 11:07 AM
The_Cat, on 28 June 2016 - 08:50 AM, said:
-- Test file lister local tFsList = fs.list("/") local tDirList = {} local tFileList = {} --#local i = 1 for i, file in ipairs(tFsList) do --for i=1, #tFsList, 1 do print(file) if fs.isDir(file) then table.insert(tDirList, file) else table.insert(tFileList, file) end end print("Files:") --#local i = 1 for i=1, #tFileList do print(tFileList[i]) end print("Directories:") --#local i = 1 You also don't need to make a variable here, it will get created in the for loop for i=1, #tDirList do --#print(tFileList[i]) <-- Was this print(tDirList[i]) --# <-- Now this end
0 members, 1 guests, 0 anonymous users