Posted 28 June 2016 - 07:54 AM
I am trying to list all files and directories on the root directory with fs.list("/") and then seperate them to individual tables.
However, it does seem to be listing the files and directories correctly.
Code:
However, it does seem to be listing the files and directories correctly.
Code:
Spoiler
-- 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
for i=1, #tDirList do
print(tFileList[i])
end