summaryrefslogtreecommitdiff
path: root/tests/protectproxy.lua
blob: 363dbf5a282ad0a5b0c41732ee0d900848a51664 (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
28
local lanes = require "lanes"
lanes.configure( 1)

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