global variables are stored in a Lua table

This commit is contained in:
Roberto Ierusalimschy 2000-05-08 16:32:53 -03:00
parent 35a6ed2838
commit 11a7022067
21 changed files with 181 additions and 275 deletions

View file

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 1.15 2000/03/30 17:19:48 roberto Exp roberto $
** $Id: ldebug.c,v 1.16 2000/03/30 20:55:50 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -159,12 +159,13 @@ static int checkfunc (lua_State *L, TObject *o) {
static void lua_getobjname (lua_State *L, StkId f, lua_Debug *ar) {
GlobalVar *g;
Hash *g = L->gt;
int i;
/* try to find a name for given function */
setnormalized(L->top, f); /* to be used by `checkfunc' */
for (g=L->rootglobal; g; g=g->next) {
if (checkfunc(L, &g->value)) {
ar->name = g->name->str;
for (i=0; i<=g->size; i++) {
if (checkfunc(L, val(node(g,i))) && ttype(key(node(g,i))) == TAG_STRING) {
ar->name = tsvalue(key(node(g,i)))->str;
ar->namewhat = "global";
return;
}