1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Add Lua bitop library (#9847)

This commit is contained in:
Lejo 2021-11-26 19:31:05 +01:00 committed by GitHub
parent 7a1464d783
commit b9051386ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 251 additions and 1 deletions

View file

@ -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;