Krock wrote:In which context do you need that function? Mostly it's enough to store data in one file.
For configuration, I'm playing around with
this mod request and wanted to have a sub-folder of the mod were kits could be stored. For example kitmod/kits/noob.kit defines the kit for the rank "noob."
ShadowNinja wrote:You can depend on LuaFileSystem and use the dir iterator.
For example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local lfs = require("lfs")
local modpath = minetest.get_modpath(minetest.get_current_modname())
print("List of textures in this mod: ")
for filename in lfs.dir(modpath .. "/textures") do
if filename ~= "." and filename ~= ".." then
print("\t" .. filename)
end
end
I saw that lfs was a solution, but I thought it wouldn't be usable in the context of minetest. Would anyone who installed the mod need to also download and install lfs or can I include it somehow?
@Sokomine: thanks for the link, I'll check it out.
EDIT: Ok the town test code helped a lot.