diff options
Diffstat (limited to 'linit.c')
| -rw-r--r-- | linit.c | 33 |
1 files changed, 31 insertions, 2 deletions
| @@ -1,8 +1,37 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: linit.c,v 1.5 2000/06/16 17:22:43 roberto Exp roberto $ | 2 | ** $Id: linit.c,v 1.6 2000/08/09 14:50:13 roberto Exp roberto $ |
| 3 | ** Initialization of libraries for lua.c | 3 | ** Initialization of libraries for lua.c |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | >>>>>>> This module is now obsolete, and is not part of Lua. <<<<<<<<< | 7 | |
| 8 | #define linit_c | ||
| 9 | #define LUA_LIB | ||
| 10 | |||
| 11 | #include "lua.h" | ||
| 12 | |||
| 13 | #include "lualib.h" | ||
| 14 | #include "lauxlib.h" | ||
| 15 | |||
| 16 | |||
| 17 | static const luaL_reg lualibs[] = { | ||
| 18 | {"", luaopen_base}, | ||
| 19 | {LUA_TABLIBNAME, luaopen_table}, | ||
| 20 | {LUA_IOLIBNAME, luaopen_io}, | ||
| 21 | {LUA_STRLIBNAME, luaopen_string}, | ||
| 22 | {LUA_MATHLIBNAME, luaopen_math}, | ||
| 23 | {LUA_DBLIBNAME, luaopen_debug}, | ||
| 24 | {"", luaopen_loadlib}, | ||
| 25 | {NULL, NULL} | ||
| 26 | }; | ||
| 27 | |||
| 28 | |||
| 29 | LUALIB_API int luaopen_stdlibs (lua_State *L) { | ||
| 30 | const luaL_reg *lib = lualibs; | ||
| 31 | for (; lib->func; lib++) { | ||
| 32 | lib->func(L); /* open library */ | ||
| 33 | lua_settop(L, 0); /* discard any results */ | ||
| 34 | } | ||
| 35 | return 0; | ||
| 36 | } | ||
| 8 | 37 | ||
