aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lbaselib.c b/lbaselib.c
index a14ce31d..1b2c687c 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.235 2009/12/28 16:30:31 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.236 2010/03/12 19:14:06 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_getfield(L, LUA_ENVIRONINDEX, "tostring"); 26 lua_getglobal(L, "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;
@@ -679,11 +679,12 @@ static void auxopen (lua_State *L, const char *name,
679static void base_open (lua_State *L) { 679static void base_open (lua_State *L) {
680 /* set global _G */ 680 /* set global _G */
681 lua_pushglobaltable(L); 681 lua_pushglobaltable(L);
682 lua_setfield(L, LUA_ENVIRONINDEX, "_G"); 682 lua_pushglobaltable(L);
683 lua_setfield(L, -2, "_G");
683 /* open lib into global table */ 684 /* open lib into global table */
684 luaL_register(L, "_G", base_funcs); 685 luaL_register(L, "_G", base_funcs);
685 lua_pushliteral(L, LUA_VERSION); 686 lua_pushliteral(L, LUA_VERSION);
686 lua_setfield(L, LUA_ENVIRONINDEX, "_VERSION"); /* set global _VERSION */ 687 lua_setfield(L, -2, "_VERSION"); /* set global _VERSION */
687 /* `ipairs' and `pairs' need auxiliary functions as upvalues */ 688 /* `ipairs' and `pairs' need auxiliary functions as upvalues */
688 auxopen(L, "ipairs", luaB_ipairs, ipairsaux); 689 auxopen(L, "ipairs", luaB_ipairs, ipairsaux);
689 auxopen(L, "pairs", luaB_pairs, luaB_next); 690 auxopen(L, "pairs", luaB_pairs, luaB_next);
@@ -694,7 +695,7 @@ static void base_open (lua_State *L) {
694 lua_pushliteral(L, "kv"); 695 lua_pushliteral(L, "kv");
695 lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ 696 lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */
696 lua_pushcclosure(L, luaB_newproxy, 1); 697 lua_pushcclosure(L, luaB_newproxy, 1);
697 lua_setfield(L, LUA_ENVIRONINDEX, "newproxy"); /* set global `newproxy' */ 698 lua_setfield(L, -2, "newproxy"); /* set global `newproxy' */
698} 699}
699 700
700 701