diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/script/cpp_api/s_base.cpp | 7 | ||||
-rw-r--r-- | src/script/cpp_api/s_security.cpp | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1549587b7..4803b475b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -500,6 +500,7 @@ include_directories( ${LUA_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${JSON_INCLUDE_DIR} + ${LUA_BIT_INCLUDE_DIR} ${X11_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/script ) @@ -537,6 +538,7 @@ if(BUILD_CLIENT) ${LUA_LIBRARY} ${GMP_LIBRARY} ${JSON_LIBRARY} + ${LUA_BIT_LIBRARY} ${PLATFORM_LIBS} ) if(NOT USE_LUAJIT) @@ -619,6 +621,7 @@ if(BUILD_SERVER) ${SQLITE3_LIBRARY} ${JSON_LIBRARY} ${LUA_LIBRARY} + ${LUA_BIT_LIBRARY} ${GMP_LIBRARY} ${PLATFORM_LIBS} ) 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; diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp index 580042ec2..5faf8cc80 100644 --- a/src/script/cpp_api/s_security.cpp +++ b/src/script/cpp_api/s_security.cpp @@ -106,6 +106,7 @@ void ScriptApiSecurity::initializeSecurity() "string", "table", "math", + "bit" }; static const char *io_whitelist[] = { "close", @@ -298,6 +299,7 @@ void ScriptApiSecurity::initializeSecurityClient() "string", "table", "math", + "bit", }; static const char *os_whitelist[] = { "clock", @@ -834,4 +836,3 @@ int ScriptApiSecurity::sl_os_remove(lua_State *L) lua_call(L, 1, 2); return 2; } - |