aboutsummaryrefslogtreecommitdiff
path: root/func.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1995-10-26 12:21:56 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1995-10-26 12:21:56 -0200
commit15d48576ea737d51e579f101a870e37f62b81f22 (patch)
treeed2390188cfb5304d366696262ccda593f3e8589 /func.c
parent39b071f7b13e6ed6eff4a0f0471d2450a9c48084 (diff)
downloadlua-15d48576ea737d51e579f101a870e37f62b81f22.tar.gz
lua-15d48576ea737d51e579f101a870e37f62b81f22.tar.bz2
lua-15d48576ea737d51e579f101a870e37f62b81f22.zip
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.
Diffstat (limited to 'func.c')
-rw-r--r--func.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/func.c b/func.c
index 601513d1..2982f661 100644
--- a/func.c
+++ b/func.c
@@ -1,7 +1,10 @@
1#include <stdio.h> 1#include <stdio.h>
2
3#include "luadebug.h"
2#include "table.h" 4#include "table.h"
3#include "mem.h" 5#include "mem.h"
4#include "func.h" 6#include "func.h"
7#include "opcode.h"
5 8
6static TFunc *function_root = NULL; 9static TFunc *function_root = NULL;
7 10
@@ -57,3 +60,20 @@ Long luaI_funccollector (void)
57 } 60 }
58 return counter; 61 return counter;
59} 62}
63
64
65void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
66{
67 Object *f = luaI_Address(func);
68 if (f->tag == LUA_T_MARK || f->tag == LUA_T_FUNCTION)
69 {
70 *filename = f->value.tf->fileName;
71 *linedefined = f->value.tf->lineDefined;
72 }
73 else if (f->tag == LUA_T_CMARK || f->tag == LUA_T_CFUNCTION)
74 {
75 *filename = "(C)";
76 *linedefined = -1;
77 }
78}
79