init.lua 901 B

1234567891011121314151617181920212223242526272829303132
  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. -- Initialize some very basic things
  8. print = core.debug
  9. math.randomseed(os.time())
  10. os.setlocale("C", "numeric")
  11. minetest = core
  12. -- Load other files
  13. local scriptdir = core.get_builtin_path()..DIR_DELIM
  14. local gamepath = scriptdir.."game"..DIR_DELIM
  15. local commonpath = scriptdir.."common"..DIR_DELIM
  16. local asyncpath = scriptdir.."async"..DIR_DELIM
  17. dofile(commonpath.."serialize.lua")
  18. dofile(commonpath.."misc_helpers.lua")
  19. if INIT == "game" then
  20. dofile(gamepath.."init.lua")
  21. elseif INIT == "mainmenu" then
  22. dofile(core.get_mainmenu_path()..DIR_DELIM.."init.lua")
  23. elseif INIT == "async" then
  24. dofile(asyncpath.."init.lua")
  25. else
  26. error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
  27. end