Files
Goober5000 ee1330669a add Lua BitOp 1.0.2
Adds the standard Lua extension library for bit operations in Lua 5.1.
http://bitop.luajit.org/

Note that this library is normally called "bit", but it is added here as "luabit" because there is already a FSO scripting library called "bit".
2022-05-31 10:23:44 -04:00

26 lines
484 B
C

#include "lua_ext.h"
#define linit_c
#define LUA_LIB
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
// NOTE: The last item in this array MUST be {NULL, NULL}.
static const luaL_Reg lualibs_ext[] = {
{LUA_BITLIBNAME, luaopen_bit},
{NULL, NULL}
};
LUALIB_API void luaL_openlibs_ext (lua_State *L) {
const luaL_Reg *lib = lualibs_ext;
for (; lib->func; lib++) {
lua_pushcfunction(L, lib->func);
lua_pushstring(L, lib->name);
lua_call(L, 1, 0);
}
}