This repository was archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.lua
More file actions
72 lines (60 loc) · 1.25 KB
/
test.lua
File metadata and controls
72 lines (60 loc) · 1.25 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require"bci"
local function inspect(f,all)
local F=inspector.getheader(f)
print("header",f)
for k,v in next,F do
print("",k,v)
end
print("constants",F.constants)
for i=1,F.constants do
local a=inspector.getconstant(f,i)
print("",i,a)
end
print("locals",F.locals)
for i=1,F.locals do
local a,b,c=inspector.getlocal(f,i)
print("",i,a,b,c)
end
print("upvalues",F.upvalues)
for i=1,F.upvalues do
local a=inspector.getupvalue(f,i)
print("",i,a)
end
print("functions",F.functions)
for i=1,F.functions do
local a=inspector.getfunction(f,i)
print("",i,a)
end
print("instructions",F.instructions)
for i=1,F.instructions do
local a,b,c,d,e=inspector.getinstruction(f,i)
print("",i,a,b,c,d,e)
if b=="GETGLOBAL" then print(">>> ",inspector.getconstant(f,-d)) end
if b=="SETGLOBAL" then print(">>>*",inspector.getconstant(f,-d)) end
end
print()
if all then
for i=1,F.functions do
inspect(inspector.getfunction(f,i),all)
end
end
end
f=function (x,y)
print(x,"=",y,23)
local z=x+2*y
local last
X=245
return inspect
end
inspect(debug.getinfo(1).func,true)
do return end
inspect(f)
inspect(inspect)
f(1,2)
inspector.setconstant(f,3,98)
f(1,2)
inspector.setconstant(f,3,123,987)
f(1,2)
inspector.setconstant(f,3)
f(1,2)
f(1,2)