Organize builtin into subdirectories
[oweals/minetest.git] / builtin / init.lua
1 --
2 -- This file contains built-in stuff in Minetest implemented in Lua.
3 --
4 -- It is always loaded and executed after registration of the C API,
5 -- before loading and running any mods.
6 --
7
8 local core = minetest or engine
9 minetest = core
10
11 -- Initialize some very basic things
12 print = core.debug
13 math.randomseed(os.time())
14 os.setlocale("C", "numeric")
15
16 -- Load other files
17 local scriptdir = core.get_builtin_path()..DIR_DELIM
18 local gamepath = scriptdir.."game"..DIR_DELIM
19 local commonpath = scriptdir.."common"..DIR_DELIM
20 local asyncpath = scriptdir.."async"..DIR_DELIM
21
22 dofile(commonpath.."serialize.lua")
23 dofile(commonpath.."misc_helpers.lua")
24
25 if INIT == "game" then
26         dofile(gamepath.."init.lua")
27 elseif INIT == "mainmenu" then
28         dofile(core.get_mainmenu_path()..DIR_DELIM.."init.lua")
29 elseif INIT == "async" then
30         dofile(asyncpath.."init.lua")
31 else
32         error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
33 end
34