-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex29.6.lua
More file actions
31 lines (25 loc) · 692 Bytes
/
ex29.6.lua
File metadata and controls
31 lines (25 loc) · 692 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
local mylib = require "mylib"
print("testing summation...")
print(mylib.summation(2.3, 5.4))
print(mylib.summation(2.3, 5.4, -34))
-- assert(mylib.summation({2.3, 5.4}) == 7.7)
-- assert(mylib.summation({2.3, 5.4, -34}) == -26.3)
print("testing pack...")
local t = mylib.pack("jack", 1, 3.14)
for _, v in pairs(t) do
print(v)
end
print("testing reverse...")
print(mylib.reverse(1, "hello", 20))
print("testing foreach...")
mylib.foreach({x = 10, y = 20}, print)
print("testing foreach_can_yield...")
local print_yield = function (...)
print(...)
coroutine.yield()
end
local co = coroutine.wrap(function ()
mylib.foreach_can_yield({x = 10, y = 20}, print_yield)
end)
co()
co()