-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.lua
More file actions
68 lines (64 loc) · 2.22 KB
/
Copy pathsample.lua
File metadata and controls
68 lines (64 loc) · 2.22 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
function name(type)
local constness = tonumber(type.constness) == 0 and 'const ' or ''
local access = tonumber(type.access) == 0 and 'const ' or ''
local ptr
if type.indirection == 0 then
return(tostring("%s%s"):format(access, type.metaclass.name))
else
if type.indirection == 1 then
ptr = "raw"
elseif type.indirection == 2 then
ptr = "weak"
elseif type.indirection == 3 then
ptr = "ref"
else
ptr = "???"
end
return(tostring("%s%s<%s%s>"):format(constness,
ptr,
access,
type.metaclass.name))
end
end
function help(klass)
function print_method(method)
for i=1, method.overloads:size(), 1 do
local overload = method.overloads[i]
local param_list = {}
for j=1, overload.params:size(), 1 do
local param = overload.params[j]
param_list[#param_list+1] = tostring('%s %s'):format(name(param.type), param.name)
end
print(tostring(' %s %s (%s)'):format(name(overload.returnType),
method.name,
table.concat(param_list, ', ')))
end
end
print(tostring('class %s'):format(klass.name))
if klass.constructor then
print('List of constructors:')
print_method(klass.constructor)
end
print('List of methods:')
for i=1, klass.methods:size(), 1 do
local method = klass.methods[i]
print_method(method)
end
print('List of properties:')
for i=1, klass.properties:size(), 1 do
local property = klass.properties[i]
print(tostring(' %s %s'):format(name(property.type), property.name))
end
print('List of objects:')
local object = klass.objects
while object do
print(tostring(' %s'):format(object.name))
object = object.next
end
end
p = plugin('sample.python')
c = p.BugEngine.TestCases.Class(1.0, 2.0)
c:doStuff{4.0, v2=8.0, v3=false}
help(BugEngine.RTTI.Class.ClassType.metaclass)
help(BugEngine.text)
help(BugEngine.DiskFolder)