diff options
Diffstat (limited to 'src/Bindings')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 7f7cb8ea9..a23b67688 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1777,6 +1777,34 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S) +static int tolua_cPluginLua_ExecuteOffThread(lua_State * tolua_S) +{ + cLuaState own = cLuaState(tolua_S); + AString luaCode; + if (!own.GetStackValue(2, luaCode)) + { + LOGWARNING("Expected string with Lua code."); + return 0; + } + + auto callback = [luaCode]() { + cLuaState state = cLuaState("Testing"); + state.Create(); + state.RegisterAPILibs(); + state.LoadStringW(luaCode, ""); + }; + + std::thread thread = std::thread(callback); + thread.detach(); + own.Push(true); + + return 1; +} + + + + + static int tolua_cPlugin_GetDirectory(lua_State * tolua_S) { cLuaState L(tolua_S); |