LuaObject.table constructor

LuaObject.table(
  1. String id, [
  2. Map<String, Object?>? fields
])

Constructs a lua object with id for its variable name in scope with some set of fields. These fields are dart Object values which means they can be primitives.

If fields is null, _fields will be assigned to the empty map {}.

Alternatively, if the fields of the table are ALL LuaObjects, whose names will be exactly the same as the field key, then LuaObject.tableFrom can be used instead.

Implementation

LuaObject.table(this.id, [Map<String, Object?>? fields]) : super() {
  _fields =
      fields?.map((k, v) => MapEntry(k, v?.toLua(k) ?? LuaObject.nil(k))) ??
      {};
}