aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 15bab389..d5596d1f 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.229 2009/11/27 15:38:51 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.230 2009/12/10 18:17:37 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -23,7 +23,7 @@
23static int luaB_print (lua_State *L) { 23static int luaB_print (lua_State *L) {
24 int n = lua_gettop(L); /* number of arguments */ 24 int n = lua_gettop(L); /* number of arguments */
25 int i; 25 int i;
26 lua_getglobal(L, "tostring"); 26 lua_getfield(L, LUA_GLOBALSINDEX, "tostring");
27 for (i=1; i<=n; i++) { 27 for (i=1; i<=n; i++) {
28 const char *s; 28 const char *s;
29 size_t l; 29 size_t l;
@@ -695,11 +695,11 @@ static void auxopen (lua_State *L, const char *name,
695static void base_open (lua_State *L) { 695static void base_open (lua_State *L) {
696 /* set global _G */ 696 /* set global _G */
697 lua_pushvalue(L, LUA_GLOBALSINDEX); 697 lua_pushvalue(L, LUA_GLOBALSINDEX);
698 lua_setglobal(L, "_G"); 698 lua_setfield(L, LUA_GLOBALSINDEX, "_G");
699 /* open lib into global table */ 699 /* open lib into global table */
700 luaL_register(L, "_G", base_funcs); 700 luaL_register(L, "_G", base_funcs);
701 lua_pushliteral(L, LUA_VERSION); 701 lua_pushliteral(L, LUA_VERSION);
702 lua_setglobal(L, "_VERSION"); /* set global _VERSION */ 702 lua_setfield(L, LUA_GLOBALSINDEX, "_VERSION"); /* set global _VERSION */
703 /* `ipairs' and `pairs' need auxiliary functions as upvalues */ 703 /* `ipairs' and `pairs' need auxiliary functions as upvalues */
704 auxopen(L, "ipairs", luaB_ipairs, ipairsaux); 704 auxopen(L, "ipairs", luaB_ipairs, ipairsaux);
705 auxopen(L, "pairs", luaB_pairs, luaB_next); 705 auxopen(L, "pairs", luaB_pairs, luaB_next);
@@ -710,7 +710,7 @@ static void base_open (lua_State *L) {
710 lua_pushliteral(L, "kv"); 710 lua_pushliteral(L, "kv");
711 lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ 711 lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */
712 lua_pushcclosure(L, luaB_newproxy, 1); 712 lua_pushcclosure(L, luaB_newproxy, 1);
713 lua_setglobal(L, "newproxy"); /* set global `newproxy' */ 713 lua_setfield(L, LUA_GLOBALSINDEX, "newproxy"); /* set global `newproxy' */
714} 714}
715 715
716 716