commit 5fc92cce12348226f229dbc9d69fae8fb4cac9de
parent 6dd0c6ccbcddc875933cab872008f57cbbbf997b
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 3 Oct 2005 11:36:23 -0300
registry._LOADED created "on demand" and baselib created as module _G
Diffstat:
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/lbaselib.c b/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.182 2005/08/26 17:36:32 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.183 2005/09/16 18:22:48 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -561,7 +561,7 @@ static int luaB_costatus (lua_State *L) {
lua_pushliteral(L, "dead");
else
lua_pushliteral(L, "suspended"); /* initial state */
- break;
+ break;
}
default: /* some error occured */
lua_pushliteral(L, "dead");
@@ -602,8 +602,11 @@ static void auxopen (lua_State *L, const char *name,
static void base_open (lua_State *L) {
+ /* set global _G */
lua_pushvalue(L, LUA_GLOBALSINDEX);
- luaL_register(L, NULL, base_funcs); /* open lib into global table */
+ lua_setglobal(L, "_G");
+ /* open lib into global table */
+ luaL_register(L, "_G", base_funcs);
lua_pushliteral(L, LUA_VERSION);
lua_setglobal(L, "_VERSION"); /* set global _VERSION */
/* `ipairs' and `pairs' need auxiliary functions as upvalues */
@@ -617,12 +620,6 @@ static void base_open (lua_State *L) {
lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */
lua_pushcclosure(L, luaB_newproxy, 1);
lua_setglobal(L, "newproxy"); /* set global `newproxy' */
- /* create register._LOADED to track loaded modules */
- lua_newtable(L);
- lua_setfield(L, LUA_REGISTRYINDEX, "_LOADED");
- /* set global _G */
- lua_pushvalue(L, LUA_GLOBALSINDEX);
- lua_setglobal(L, "_G");
}