-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadvanced_test.lua
More file actions
36 lines (31 loc) · 839 Bytes
/
Copy pathadvanced_test.lua
File metadata and controls
36 lines (31 loc) · 839 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
advanced_demonstration = true;
function get_weights()
local s = sentinel()
s:foo("original data that's kinda long")
return {
first=0.5,
second=13.37,
blurgh=123.456,
special=s
}
end
function print_weights(weights)
print('Lua received weights:\n')
for k,v in pairs(weights) do
if k == 'special' then
print(string.format('received special! special.bar() = %s\n', weights[k]:bar()))
else
print(string.format('\t%s: %s\n', tostring(k), tostring(weights[k])))
end
end
end
function print_array(a)
print('Lua received array:\n')
for k,v in ipairs(a) do
print(string.format('\t%s: %s\n', tostring(k), tostring(v)))
end
end
function get_array()
return {1, 2, 3}
end
return 'Lua advanced demonstration complete'