3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "scripting_mainmenu.h"
23 #include "cpp_api/s_internal.h"
24 #include "lua_api/l_base.h"
25 #include "lua_api/l_mainmenu.h"
26 #include "lua_api/l_util.h"
32 MainMenuScripting::MainMenuScripting(GUIEngine* guiengine)
34 setGuiEngine(guiengine);
38 luaL_openlibs(getStack());
40 SCRIPTAPI_PRECHECKHEADER
42 lua_pushstring(L, DIR_DELIM);
43 lua_setglobal(L, "DIR_DELIM");
46 lua_setglobal(L, "gamedata");
49 lua_setglobal(L, "engine");
51 // Initialize our lua_api modules
52 lua_getglobal(L, "engine");
53 int top = lua_gettop(L);
54 InitializeModApi(L, top);
57 infostream << "SCRIPTAPI: initialized mainmenu modules" << std::endl;
60 void MainMenuScripting::InitializeModApi(lua_State *L, int top)
62 // Initialize mod api modules
63 ModApiMainMenu::Initialize(L, top);
64 ModApiUtil::Initialize(L, top);