LuaObject constructor

LuaObject(
  1. String id, {
  2. LuaFieldsMap? fields,
  3. Object? value,
})

Default constructor for some lua object. The variable name in scope will become id and can have either fields or value but not both.

Implementation

LuaObject(this.id, {LuaFieldsMap? fields, Object? value})
  : _value = value,
    _fields = fields,
    assert(
      (value == null || fields == null),
      '''A lua object's storage can either be a value or
        a set of fields if it should become a table, but it
        cannot have both!
      ''',
    );