summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorNiLSPACE <niels.breuker@hotmail.nl>2020-09-22 15:23:49 +0200
committerNiLSPACE <niels.breuker@hotmail.nl>2020-09-22 15:23:49 +0200
commit92fac6b5b47764031a8a163cce29cafacff158f4 (patch)
tree34ee93a3e5541239394d22470293e56f97bf2a38 /src/Bindings
parentfixed missing include for FreeBSD. (#4852) (diff)
downloadcuberite-92fac6b5b47764031a8a163cce29cafacff158f4.tar
cuberite-92fac6b5b47764031a8a163cce29cafacff158f4.tar.gz
cuberite-92fac6b5b47764031a8a163cce29cafacff158f4.tar.bz2
cuberite-92fac6b5b47764031a8a163cce29cafacff158f4.tar.lz
cuberite-92fac6b5b47764031a8a163cce29cafacff158f4.tar.xz
cuberite-92fac6b5b47764031a8a163cce29cafacff158f4.tar.zst
cuberite-92fac6b5b47764031a8a163cce29cafacff158f4.zip
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/ManualBindings.cpp28
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);