aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_base.cpp
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-09-26 07:23:48 -0400
committerGitHub <noreply@github.com>2022-09-26 07:23:48 -0400
commit03428d9825cfdf2cfaed6ac9410dafccac0d4f3a (patch)
tree3f6bacfa9e074e6e523698a10b0195349612eaa8 /src/script/cpp_api/s_base.cpp
parentf916398a541dbd09cbf14409f358556bc42f5535 (diff)
downloadminetest-03428d9825cfdf2cfaed6ac9410dafccac0d4f3a.tar.xz
Modify PUC Lua to wrap C++ exceptions (#12445)
Diffstat (limited to 'src/script/cpp_api/s_base.cpp')
-rw-r--r--src/script/cpp_api/s_base.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index 659b32777..5569a536e 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -109,12 +109,14 @@ ScriptApiBase::ScriptApiBase(ScriptingType type):
lua_rawseti(m_luastack, LUA_REGISTRYINDEX, CUSTOM_RIDX_BACKTRACE);
lua_pop(m_luastack, 1); // pop debug
- // If we are using LuaJIT add a C++ wrapper function to catch
- // exceptions thrown in Lua -> C++ calls
+ // Add a C++ wrapper function to catch exceptions thrown in Lua -> C++ calls
#if USE_LUAJIT
lua_pushlightuserdata(m_luastack, (void*) script_exception_wrapper);
luaJIT_setmode(m_luastack, -1, LUAJIT_MODE_WRAPCFUNC | LUAJIT_MODE_ON);
lua_pop(m_luastack, 1);
+#else
+ // (This is a custom API from the bundled Lua.)
+ lua_atccall(m_luastack, script_exception_wrapper);
#endif
// Add basic globals