Resources | Resources |



IDL union in Lua

An IDL union is mapped to a Lua table with a case field for the discriminator, and a value field for the value. For example, given the declaration:

union Un switch(color)
  case RED:
     IFoo foo;
  case GREEN:
  case BLUE:
     long lng;
     short sh;

A union with the lng field set and a discriminator value of BLUE would be:

local un = {case = BLUE, value = 123}