linit.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #define linit_c
00009 #define LUA_LIB
00010
00011 #include "lua.h"
00012
00013 #include "lualib.h"
00014 #include "lauxlib.h"
00015
00016
00017 static const luaL_Reg lualibs[] = {
00018 {"", luaopen_base},
00019 {LUA_LOADLIBNAME, luaopen_package},
00020 {LUA_TABLIBNAME, luaopen_table},
00021 {LUA_IOLIBNAME, luaopen_io},
00022 {LUA_OSLIBNAME, luaopen_os},
00023 {LUA_STRLIBNAME, luaopen_string},
00024 {LUA_MATHLIBNAME, luaopen_math},
00025 {LUA_DBLIBNAME, luaopen_debug},
00026 {NULL, NULL}
00027 };
00028
00029
00030 LUALIB_API void luaL_openlibs (lua_State *L) {
00031 const luaL_Reg *lib = lualibs;
00032 for (; lib->func; lib++) {
00033 lua_pushcfunction(L, lib->func);
00034 lua_pushstring(L, lib->name);
00035 lua_call(L, 1, 0);
00036 }
00037 }