mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Add Lua bitop library (#9847)
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user