File: lua_ext.c

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites:
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (25 lines) | stat: -rw-r--r-- 484 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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);
  }
}