aboutsummaryrefslogtreecommitdiff
path: root/table.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-01-26 16:03:19 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-01-26 16:03:19 -0200
commit0d50b87aa47d3cb64730bf5c8646e5e6ff02c268 (patch)
treeadfab90a2efad542f12d7d7b0219226deedcb7a5 /table.c
parent19290a8e92a9b22f448b82c2bcb67ea635dee6ad (diff)
downloadlua-0d50b87aa47d3cb64730bf5c8646e5e6ff02c268.tar.gz
lua-0d50b87aa47d3cb64730bf5c8646e5e6ff02c268.tar.bz2
lua-0d50b87aa47d3cb64730bf5c8646e5e6ff02c268.zip
lua_table now has references to global variable names (TreeNode's).
Diffstat (limited to 'table.c')
-rw-r--r--table.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/table.c b/table.c
index 7c7f124c..587d582d 100644
--- a/table.c
+++ b/table.c
@@ -3,7 +3,7 @@
3** Module to control static tables 3** Module to control static tables
4*/ 4*/
5 5
6char *rcs_table="$Id: table.c,v 2.42 1996/01/23 18:39:45 roberto Exp roberto $"; 6char *rcs_table="$Id: table.c,v 2.43 1996/01/26 14:04:32 roberto Exp roberto $";
7 7
8/*#include <string.h>*/ 8/*#include <string.h>*/
9 9
@@ -101,6 +101,7 @@ Word luaI_findsymbol (TreeNode *t)
101 lua_table = growvector(lua_table, lua_maxsymbol, Symbol); 101 lua_table = growvector(lua_table, lua_maxsymbol, Symbol);
102 } 102 }
103 t->varindex = lua_ntable; 103 t->varindex = lua_ntable;
104 lua_table[lua_ntable].varname = t;
104 s_tag(lua_ntable) = LUA_T_NIL; 105 s_tag(lua_ntable) = LUA_T_NIL;
105 lua_ntable++; 106 lua_ntable++;
106 } 107 }
@@ -155,7 +156,7 @@ static char *lua_travsymbol (int (*fn)(Object *))
155 Word i; 156 Word i;
156 for (i=0; i<lua_ntable; i++) 157 for (i=0; i<lua_ntable; i++)
157 if (fn(&s_object(i))) 158 if (fn(&s_object(i)))
158 return luaI_nodebysymbol(i)->ts.str; 159 return lua_table[i].varname->ts.str;
159 return NULL; 160 return NULL;
160} 161}
161 162
@@ -234,7 +235,7 @@ static void lua_nextvar (void)
234 } 235 }
235 else 236 else
236 { 237 {
237 TreeNode *t = luaI_nodebysymbol(next); 238 TreeNode *t = lua_table[next].varname;
238 Object name; 239 Object name;
239 tag(&name) = LUA_T_STRING; 240 tag(&name) = LUA_T_STRING;
240 tsvalue(&name) = &(t->ts); 241 tsvalue(&name) = &(t->ts);