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

Developer

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;
  default:
     short sh;
};

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

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