summaryrefslogtreecommitdiff
path: root/src/script/scripting_mainmenu.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/script/scripting_mainmenu.cpp
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/script/scripting_mainmenu.cpp')
-rw-r--r--src/script/scripting_mainmenu.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/script/scripting_mainmenu.cpp b/src/script/scripting_mainmenu.cpp
index b1e50c94b..48957b472 100644
--- a/src/script/scripting_mainmenu.cpp
+++ b/src/script/scripting_mainmenu.cpp
@@ -19,11 +19,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "scripting_mainmenu.h"
#include "mods.h"
-#include "porting.h"
-#include "log.h"
#include "cpp_api/s_internal.h"
#include "lua_api/l_base.h"
#include "lua_api/l_mainmenu.h"
+#include "lua_api/l_sound.h"
#include "lua_api/l_util.h"
#include "lua_api/l_settings.h"
@@ -60,16 +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,13 +76,21 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top)
}
/******************************************************************************/
-void MainMenuScripting::step() {
+void MainMenuScripting::registerLuaClasses(lua_State *L, int top)
+{
+ LuaSettings::Register(L);
+}
+
+/******************************************************************************/
+void MainMenuScripting::step()
+{
asyncEngine.step(getStack());
}
/******************************************************************************/
-unsigned int MainMenuScripting::queueAsync(std::string serialized_func,
- std::string serialized_param) {
+unsigned int MainMenuScripting::queueAsync(const std::string &serialized_func,
+ const std::string &serialized_param)
+{
return asyncEngine.queueAsyncJob(serialized_func, serialized_param);
}