Mercurial > vba-clojure
annotate src/lua/linit.c @ 365:dc39dfcad61f
almost halfway there!
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 09 Apr 2012 11:31:09 -0500 |
parents | 27763b933818 |
children |
rev | line source |
---|---|
rlm@1 | 1 /* |
rlm@1 | 2 ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ |
rlm@1 | 3 ** Initialization of libraries for lua.c |
rlm@1 | 4 ** See Copyright Notice in lua.h |
rlm@1 | 5 */ |
rlm@1 | 6 |
rlm@1 | 7 |
rlm@1 | 8 #define linit_c |
rlm@1 | 9 #define LUA_LIB |
rlm@1 | 10 |
rlm@1 | 11 #include "lua.h" |
rlm@1 | 12 |
rlm@1 | 13 #include "lualib.h" |
rlm@1 | 14 #include "lauxlib.h" |
rlm@1 | 15 |
rlm@1 | 16 |
rlm@1 | 17 static const luaL_Reg lualibs[] = { |
rlm@1 | 18 {"", luaopen_base}, |
rlm@1 | 19 {LUA_LOADLIBNAME, luaopen_package}, |
rlm@1 | 20 {LUA_TABLIBNAME, luaopen_table}, |
rlm@1 | 21 {LUA_IOLIBNAME, luaopen_io}, |
rlm@1 | 22 {LUA_OSLIBNAME, luaopen_os}, |
rlm@1 | 23 {LUA_STRLIBNAME, luaopen_string}, |
rlm@1 | 24 {LUA_MATHLIBNAME, luaopen_math}, |
rlm@1 | 25 {LUA_DBLIBNAME, luaopen_debug}, |
rlm@1 | 26 {NULL, NULL} |
rlm@1 | 27 }; |
rlm@1 | 28 |
rlm@1 | 29 |
rlm@1 | 30 LUALIB_API void luaL_openlibs (lua_State *L) { |
rlm@1 | 31 const luaL_Reg *lib = lualibs; |
rlm@1 | 32 for (; lib->func; lib++) { |
rlm@1 | 33 lua_pushcfunction(L, lib->func); |
rlm@1 | 34 lua_pushstring(L, lib->name); |
rlm@1 | 35 lua_call(L, 1, 0); |
rlm@1 | 36 } |
rlm@1 | 37 } |
rlm@1 | 38 |