Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

IDL rout parameter of a method in Lua

When a sequence is specified as a rout parameter of a method of an interface, the mapping generates an input constraint parameter for the constraints of the sequence, and the returned sequence is wrapped with a table that specifies the length required in the length field.

For example:

simpleio:Write({1,2,3,4,5,6,7,8,9,10})
local seq, lenReq = simpleio:Read(2)
assert(lenReq == 10)
assert(seq[1] == 1}
assert(seq[2] == 2}

When the elements of a sequence also require constraint parameters, pass a table of constraints. The length of that table represents the length expected for the returned sequence.

For example:

complexio:Write({union1,union2,union3})
local cons = {{case=RED}, {case=GREEN}, {case=BLUE}}
assert(#cons == 3)
local seq, lenReq = complex:Read(cons)
assert(lenReq == 3)
assert(#seq == 3)
assert(seq[1].case == RED)