writeFields method
A convenience utility to write all fields from some input map.
This assumes you may need the name of the field to be different
from any existing LuaObject.id in the entries.
Alternatively, if the name of the fields are known to match the input LuaObjects, then consider using writeFieldsFrom.
Implementation
void writeFields(LuaFieldsMap map) {
final ref = deref();
for (final f in map.entries) {
ref.writeField(f.key, f.value);
}
}