summaryrefslogtreecommitdiff
path: root/src/linit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linit.c')
-rw-r--r--src/linit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/linit.c b/src/linit.c
index 24f70edb..afcd338b 100644
--- a/src/linit.c
+++ b/src/linit.c
@@ -1,5 +1,5 @@
/*
-** $Id: linit.c,v 1.9 2005/02/18 12:40:02 roberto Exp $
+** $Id: linit.c,v 1.11 2005/04/13 17:24:20 roberto Exp $
** Initialization of libraries for lua.c
** See Copyright Notice in lua.h
*/
@@ -22,19 +22,17 @@ static const luaL_reg lualibs[] = {
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{LUA_DBLIBNAME, luaopen_debug},
- {"", luaopen_loadlib},
+ {LUA_LOADLIBNAME, luaopen_loadlib},
{NULL, NULL}
};
-LUALIB_API int luaopen_stdlibs (lua_State *L) {
+LUALIB_API void luaL_openlibs (lua_State *L) {
const luaL_reg *lib = lualibs;
for (; lib->func; lib++) {
- lib->func(L); /* open library */
- lua_settop(L, 0); /* discard any results */
- lua_pushvalue(L, LUA_GLOBALSINDEX);
- lua_replace(L, LUA_ENVIRONINDEX); /* restore environment */
+ lua_pushcfunction(L, lib->func);
+ lua_pushstring(L, lib->name);
+ lua_call(L, 1, 0);
}
- return 0;
}