Cuberite Forum

Full Version: List of files in dir
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need a way to get a list of all the files in a directory or is there already a function. I googled for it but i could not find a way to do it.
I'm currently using this, but it's Windows-specific:
for filename in io.popen([[dir wikipages\\api\\*.txt /b]]):lines() do
I think we have something for that. MCServer uses it to load all files in a plugin directory. I can't look it up right now though. Also I'm not sure if it's exposed to lua
I'm thinking about bringing in the LuaFileSystem library:
https://github.com/mc-server/MCServer/issues/162

LFS: https://github.com/keplerproject/luafilesystem