aboutsummaryrefslogtreecommitdiff
path: root/lbuiltin.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbuiltin.c')
-rw-r--r--lbuiltin.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lbuiltin.c b/lbuiltin.c
index db7e473c..1143dae7 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbuiltin.c,v 1.51 1999/02/12 19:23:02 roberto Exp roberto $ 2** $Id: lbuiltin.c,v 1.52 1999/02/22 14:17:24 roberto Exp roberto $
3** Built-in functions 3** Built-in functions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -517,16 +517,12 @@ static void luaB_nextvar (void) {
517 TObject *o = luaA_Address(luaL_nonnullarg(1)); 517 TObject *o = luaA_Address(luaL_nonnullarg(1));
518 TaggedString *g; 518 TaggedString *g;
519 if (ttype(o) == LUA_T_NIL) 519 if (ttype(o) == LUA_T_NIL)
520 g = (TaggedString *)L->rootglobal.next; /* first variable */ 520 g = NULL;
521 else { 521 else {
522 luaL_arg_check(ttype(o) == LUA_T_STRING, 1, "variable name expected"); 522 luaL_arg_check(ttype(o) == LUA_T_STRING, 1, "variable name expected");
523 g = tsvalue(o); /* find given variable name */ 523 g = tsvalue(o);
524 /* check whether name is in global var list */
525 luaL_arg_check((GCnode *)g != g->head.next, 1, "variable name expected");
526 g = (TaggedString *)g->head.next; /* get next */
527 } 524 }
528 while (g && g->u.s.globalval.ttype == LUA_T_NIL) /* skip globals with nil */ 525 g = luaA_nextvar(g);
529 g = (TaggedString *)g->head.next;
530 if (g) { 526 if (g) {
531 pushtagstring(g); 527 pushtagstring(g);
532 luaA_pushobject(&g->u.s.globalval); 528 luaA_pushobject(&g->u.s.globalval);