aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_base.cpp
diff options
context:
space:
mode:
authorLejo <Lejo_1@web.de>2021-11-26 19:31:05 +0100
committerGitHub <noreply@github.com>2021-11-26 19:31:05 +0100
commitb9051386ae296a6112383725bc8bfcd96dc9a226 (patch)
treee3dbb8998a73e19b6b0bc6c24d7d9f3515ed6ea2 /src/script/cpp_api/s_base.cpp
parent7a1464d783742512fdc6e0a083ffadd0ce63c1b4 (diff)
downloadminetest-b9051386ae296a6112383725bc8bfcd96dc9a226.tar.gz
minetest-b9051386ae296a6112383725bc8bfcd96dc9a226.tar.bz2
minetest-b9051386ae296a6112383725bc8bfcd96dc9a226.zip
Add Lua bitop library (#9847)
Diffstat (limited to 'src/script/cpp_api/s_base.cpp')
-rw-r--r--src/script/cpp_api/s_base.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index 921f713c0..f7b8a5102 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -37,6 +37,8 @@ extern "C" {
#include "lualib.h"
#if USE_LUAJIT
#include "luajit.h"
+#else
+ #include "bit.h"
#endif
}
@@ -88,6 +90,11 @@ ScriptApiBase::ScriptApiBase(ScriptingType type):
else
luaL_openlibs(m_luastack);
+ // Load bit library
+ lua_pushcfunction(m_luastack, luaopen_bit);
+ lua_pushstring(m_luastack, LUA_BITLIBNAME);
+ lua_call(m_luastack, 1, 0);
+
// Make the ScriptApiBase* accessible to ModApiBase
#if INDIRECT_SCRIPTAPI_RIDX
*(void **)(lua_newuserdata(m_luastack, sizeof(void *))) = this;