mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-09-12 08:08:30 +02:00
Add io compatibility layer
....I can't believe that Lua doesn't have an inbuilt scandir equivalent?!
This commit is contained in:
parent
1e9a651537
commit
f259f85771
@ -18,6 +18,9 @@ wea.Queue = dofile(wea.modpath.."/utils/queue.lua")
|
||||
wea.LRU = dofile(wea.modpath.."/utils/lru.lua")
|
||||
wea.inspect = dofile(wea.modpath.."/utils/inspect.lua")
|
||||
|
||||
-- I/O compatibility layer
|
||||
wea.io = dofile(wea.modpath.."/utils/io.lua")
|
||||
|
||||
wea.bit = dofile(wea.modpath.."/utils/bit.lua")
|
||||
|
||||
|
||||
|
14
worldeditadditions/utils/io.lua
Normal file
14
worldeditadditions/utils/io.lua
Normal file
@ -0,0 +1,14 @@
|
||||
local io = {
|
||||
-- Ref https://minetest.gitlab.io/minetest/minetest-namespace-reference/#utilities
|
||||
scandir = function(dirpath)
|
||||
return minetest.get_dir_list(dirpath, nil)
|
||||
end,
|
||||
scandir_files = function(dirpath)
|
||||
return minetest.get_dir_list(dirpath, false)
|
||||
end,
|
||||
scandir_dirs = function(dirpath)
|
||||
return minetest.get_dir_list(dirpath, true)
|
||||
end,
|
||||
}
|
||||
|
||||
return io
|
Loading…
Reference in New Issue
Block a user