diff options
Diffstat (limited to 'src/script/scripting_mainmenu.cpp')
-rw-r--r-- | src/script/scripting_mainmenu.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/script/scripting_mainmenu.cpp b/src/script/scripting_mainmenu.cpp index d79864a95..48957b472 100644 --- a/src/script/scripting_mainmenu.cpp +++ b/src/script/scripting_mainmenu.cpp @@ -59,17 +59,16 @@ MainMenuScripting::MainMenuScripting(GUIEngine* guiengine) /******************************************************************************/ void MainMenuScripting::initializeModApi(lua_State *L, int top) { + registerLuaClasses(L, top); + // Initialize mod API modules ModApiMainMenu::Initialize(L, top); ModApiUtil::Initialize(L, top); ModApiSound::Initialize(L, top); - // Register reference classes (userdata) - LuaSettings::Register(L); - - // Register functions to async environment - ModApiMainMenu::InitializeAsync(asyncEngine); - ModApiUtil::InitializeAsync(asyncEngine); + asyncEngine.registerStateInitializer(registerLuaClasses); + asyncEngine.registerStateInitializer(ModApiMainMenu::InitializeAsync); + asyncEngine.registerStateInitializer(ModApiUtil::InitializeAsync); // Initialize async environment //TODO possibly make number of async threads configurable @@ -77,6 +76,12 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top) } /******************************************************************************/ +void MainMenuScripting::registerLuaClasses(lua_State *L, int top) +{ + LuaSettings::Register(L); +} + +/******************************************************************************/ void MainMenuScripting::step() { asyncEngine.step(getStack()); |