2 -- This file contains built-in stuff in Minetest implemented in Lua.
4 -- It is always loaded and executed after registration of the C API,
5 -- before loading and running any mods.
8 -- Initialize some very basic things
10 math.randomseed(os.time())
11 os.setlocale("C", "numeric")
15 local scriptdir = core.get_builtin_path()..DIR_DELIM
16 local gamepath = scriptdir.."game"..DIR_DELIM
17 local commonpath = scriptdir.."common"..DIR_DELIM
18 local asyncpath = scriptdir.."async"..DIR_DELIM
20 dofile(commonpath.."strict.lua")
21 dofile(commonpath.."serialize.lua")
22 dofile(commonpath.."misc_helpers.lua")
24 if INIT == "game" then
25 dofile(gamepath.."init.lua")
26 elseif INIT == "mainmenu" then
27 local mainmenuscript = core.setting_get("main_menu_script")
28 if mainmenuscript ~= nil and mainmenuscript ~= "" then
29 dofile(mainmenuscript)
31 dofile(core.get_mainmenu_path()..DIR_DELIM.."init.lua")
33 elseif INIT == "async" then
34 dofile(asyncpath.."init.lua")
36 error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))