this is great!
btw why do you check sector existence with the game api instead of iterating trough all the files that ends in v in the sector folder?
function scandir(directory)
local i, t, popen = 0, {}, io.popen
local BinaryFormat = package.cpath:match("%p[\\|/]?%p(%a+)")
if BinaryFormat == "dll" then --am bit rusty, might not be reliable when embedded, but you get the gist of it
local cmd = 'dir "'..directory..'" /b /ad'
else
local cmd = 'ls -a "'..directory..'"'
end
local pfile = popen(cmd)
for filename in pfile:lines() do
if string.sub(filename,-1) == "v" then
i = i + 1
t[i] = filename
end
end
pfile:close()
return t
end