functions now may be declared with any "var" as a name;

therefore they do not have a "baptism" name.
Changes in debug API to acomodate that.
This commit is contained in:
Roberto Ierusalimschy
1995-10-26 12:21:56 -02:00
parent 39b071f7b1
commit 15d48576ea
8 changed files with 140 additions and 127 deletions

20
func.c
View File

@@ -1,7 +1,10 @@
#include <stdio.h>
#include "luadebug.h"
#include "table.h"
#include "mem.h"
#include "func.h"
#include "opcode.h"
static TFunc *function_root = NULL;
@@ -57,3 +60,20 @@ Long luaI_funccollector (void)
}
return counter;
}
void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
{
Object *f = luaI_Address(func);
if (f->tag == LUA_T_MARK || f->tag == LUA_T_FUNCTION)
{
*filename = f->value.tf->fileName;
*linedefined = f->value.tf->lineDefined;
}
else if (f->tag == LUA_T_CMARK || f->tag == LUA_T_CFUNCTION)
{
*filename = "(C)";
*linedefined = -1;
}
}