XboxUnity / AuroraScripts

Various LUA scripts for Aurora
33 stars 16 forks source link

Loop through FileSystem table #15

Closed thenicnic closed 2 years ago

thenicnic commented 2 years ago

I try to iterate through the following table: table FileSystem.GetFilesAndDirectories( string path );

But I do not manage to get a valid output, neither by iterating a "key, value" loop nor a "index, data" loop. Also

local discContent = FileSystem.GetFilesAndDirectories("Dvd:\\"); ret = Script.ShowMessageBox("Test", tprint(discContent), "OK") or ret = Script.ShowMessageBox("Test", tostring(tprint(discContent)), "OK")

do not work.

I'd like to have a script for quick importing games in a file system directory (since Disc to GOD does not work with OG Xbox games) but I'm new to Lua.

thenicnic commented 2 years ago

Nevermind, found a working way:

local discContent = FileSystem.GetFilesAndDirectories("Dvd:\\" .. "*") for i, item in pairs(discContent) do if item.Attributes == 1 then --file elseif item.Attributes == 17 then --directory end end