diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-07-09 11:29:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-07-09 11:29:29 -0300 |
commit | 31f6540fba010b941b44b2bd21672786d2e63e7f (patch) | |
tree | 2824e407b7c04099b7c7f11d47f025c5271f2905 /linit.c | |
parent | eab1965c05f2ef71f715347e280733e7657993e4 (diff) | |
download | lua-31f6540fba010b941b44b2bd21672786d2e63e7f.tar.gz lua-31f6540fba010b941b44b2bd21672786d2e63e7f.tar.bz2 lua-31f6540fba010b941b44b2bd21672786d2e63e7f.zip |
back with an "open all libs" function
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 | ||