aboutsummaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tree.c b/tree.c
index bca29994..eee5a204 100644
--- a/tree.c
+++ b/tree.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_tree="$Id: tree.c,v 1.3 1994/11/10 20:41:37 roberto Exp roberto $"; 6char *rcs_tree="$Id: tree.c,v 1.4 1994/11/14 21:40:14 roberto Exp roberto $";
7 7
8 8
9#include <stdlib.h> 9#include <stdlib.h>
@@ -169,9 +169,18 @@ static TreeNode *tree_next (TreeNode *node, char *str)
169 } 169 }
170} 170}
171 171
172char *lua_varnext (char *n) 172TreeNode *lua_varnext (char *n)
173{ 173{
174 TreeNode *result = tree_next(constant_root, n); 174 TreeNode *result;
175 return result != NULL ? result->str : NULL; 175 char *name = n;
176 while (1)
177 { /* repeat until a valid (non nil) variable */
178 result = tree_next(constant_root, name);
179 if (result == NULL) return NULL;
180 if (result->varindex != UNMARKED_STRING &&
181 s_tag(result->varindex) != LUA_T_NIL)
182 return result;
183 name = result->str;
184 }
176} 185}
177 186