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
9 function core
.debug(...) core
.log(table.concat({...}, "\t")) end
11 local core_print
= core
.print
12 -- Override native print and use
13 -- terminal if that's turned on
15 local n
, t
= select("#", ...), {...}
19 core_print(table.concat(t
, "\t"))
21 core
.print = nil -- don't pollute our namespace
23 math
.randomseed(os
.time())
27 local scriptdir
= core
.get_builtin_path()
28 local gamepath
= scriptdir
.. "game" .. DIR_DELIM
29 local clientpath
= scriptdir
.. "client" .. DIR_DELIM
30 local commonpath
= scriptdir
.. "common" .. DIR_DELIM
31 local asyncpath
= scriptdir
.. "async" .. DIR_DELIM
33 dofile(commonpath
.. "strict.lua")
34 dofile(commonpath
.. "serialize.lua")
35 dofile(commonpath
.. "misc_helpers.lua")
37 if INIT
== "game" then
38 dofile(gamepath
.. "init.lua")
39 elseif INIT
== "mainmenu" then
40 local mm_script
= core
.settings
:get("main_menu_script")
41 if mm_script
and mm_script
~= "" then
44 dofile(core
.get_mainmenu_path() .. DIR_DELIM
.. "init.lua")
46 elseif INIT
== "async" then
47 dofile(asyncpath
.. "init.lua")
48 elseif INIT
== "client" then
49 dofile(clientpath
.. "init.lua")
51 error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT
)))