blob: 57ca831b0af7f77c42be549c119534cdebd581ab (
plain)
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
|
require "lanes"
local body = function( param)
print ( "lane body: " .. param)
return 1
end
local gen = lanes.gen( "*", body)
local mylane = gen( "hello")
local result = mylane[1]
-- make sure we have properly protected the lane
-- can't access the metatable
print( "metatable:" .. tostring( getmetatable( mylane)))
-- can't write to the userdata
print( "lane result: " .. mylane[1])
-- read nonexistent values -> nil
print "reading nonexistent return value"
a = mylane[2]
print "writing to the lane -> error"
mylane[4] = true
|