aboutsummaryrefslogtreecommitdiff
path: root/func.c
diff options
context:
space:
mode:
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