Resources | 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:

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:

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)