-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
44 lines (36 loc) · 1020 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
b = {}
-- Do a file relative to the current mod.
b.dofile = function(path)
return dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/" .. path)
end
b.DODIR_INIT = "init.lua"
b.dodir = function(path, recursive)
local gpath = minetest.get_modpath(minetest.get_current_modname()) .. "/" .. path
local names = b.set(minetest.get_dir_list(gpath, false))
-- Execute init file first if it exists.
if names[b.DODIR_INIT] then
dofile(gpath .. "/" .. b.DODIR_INIT)
names[b.DODIR_INIT] = nil
end
-- Execute all other files.
for name in b.set.iter(names) do
dofile(gpath .. "/" .. name)
end
-- Descend recursively.
if recursive then
for _,name in ipairs(minetest.get_dir_list(gpath, true)) do
b.dodir(path .. "/" .. name, recursive)
end
end
end
b.dofile("chance.lua")
b.dofile("cache.lua")
b.dofile("table.lua")
b.dofile("set.lua")
b.dofile("uid.lua")
b.dofile("math.lua")
b.dofile("color.lua")
b.dodir("geometry")
b.dodir("pathfinder")
b.dofile("ref_table.lua")
b.dofile("world.lua")