-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrace.lua
More file actions
47 lines (35 loc) · 824 Bytes
/
Copy pathtrace.lua
File metadata and controls
47 lines (35 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function printValue()
local info = debug.getinfo(2);
for i = 1, math.huge do
local n, v = debug.getlocal(2, i)
if(not n) then break end
print("--local value---", n, v)
end
local func = debug.getinfo(2, "f").func;
for i = 1, math.huge do
local n, v = debug.getupvalue(func, i)
if(not n) then break end
print("--upvalue---", n, v)
end
end
function trace(event, line)
local s = debug.getinfo(2).short_src
print(s .. ":" .. line)
end
-- debug.sethook(trace, "l");
local function printt(t)
for k, v in pairs(t) do
print(k, v)
end
end
local up = 2;
local function test(b, c, d)
local a = 1;
for i = 1, 10 do
print(i, i)
end
printValue()
local t = debug.getinfo(1);
printt(t)
end
test(1)