diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-11-05 09:59:14 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-11-05 09:59:14 -0200 |
| commit | fa198197a0202bd3a7b68d228cd1c2fd88166ff7 (patch) | |
| tree | 536f37e38fb5e80fa580c42f2d09d6e10410e075 /lbaselib.c | |
| parent | 1e944de6cb6a20f6abeaab6f5d1039d06d8d2812 (diff) | |
| download | lua-fa198197a0202bd3a7b68d228cd1c2fd88166ff7.tar.gz lua-fa198197a0202bd3a7b68d228cd1c2fd88166ff7.tar.bz2 lua-fa198197a0202bd3a7b68d228cd1c2fd88166ff7.zip | |
lua_(set)getglobal are ok to use
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.135 2003/10/10 12:57:55 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.136 2003/10/23 18:06:22 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 | */ |
| @@ -218,7 +218,7 @@ static int luaB_next (lua_State *L) { | |||
| 218 | 218 | ||
| 219 | static int luaB_pairs (lua_State *L) { | 219 | static int luaB_pairs (lua_State *L) { |
| 220 | luaL_checktype(L, 1, LUA_TTABLE); | 220 | luaL_checktype(L, 1, LUA_TTABLE); |
| 221 | lua_getfield(L, LUA_GLOBALSINDEX, "next"); /* return generator, */ | 221 | lua_getglobal(L, "next"); /* return generator, */ |
| 222 | lua_pushvalue(L, 1); /* state, */ | 222 | lua_pushvalue(L, 1); /* state, */ |
| 223 | lua_pushnil(L); /* and initial value */ | 223 | lua_pushnil(L); /* and initial value */ |
| 224 | return 3; | 224 | return 3; |
| @@ -229,7 +229,7 @@ static int luaB_ipairs (lua_State *L) { | |||
| 229 | int i = (int)lua_tointeger(L, 2); | 229 | int i = (int)lua_tointeger(L, 2); |
| 230 | luaL_checktype(L, 1, LUA_TTABLE); | 230 | luaL_checktype(L, 1, LUA_TTABLE); |
| 231 | if (i == 0 && lua_isnone(L, 2)) { /* `for' start? */ | 231 | if (i == 0 && lua_isnone(L, 2)) { /* `for' start? */ |
| 232 | lua_getfield(L, LUA_GLOBALSINDEX, "ipairs"); /* return generator, */ | 232 | lua_getglobal(L, "ipairs"); /* return generator, */ |
| 233 | lua_pushvalue(L, 1); /* state, */ | 233 | lua_pushvalue(L, 1); /* state, */ |
| 234 | lua_pushinteger(L, 0); /* and initial value */ | 234 | lua_pushinteger(L, 0); /* and initial value */ |
| 235 | return 3; | 235 | return 3; |
