UiDataModel¶
Extends EngineObject.
A data model: a script's table tied to documents.
{{score}}
shows score of the table; data-if, data-for, data-class-, data-style- and data-value (which writes back what the player types) use it too, and data-event-click="buy(1)" calls the table's function buy. The table is read when RmlUi needs a value: change it and say so with Dirty (or change a top-level field with Set), and the elements that show it are updated at the next frame.Properties¶
name: stringThe name documents use in data-model. Read-only.is_open: booleanWhether the model still exists (it is closed with Close, when the module that opened it reloads, and when the UI ends). Read-only.
Methods¶
dirty¶
function dirty(self, name: string?): ()
Says that the field (a top-level one) or, with no name, everything changed: the elements that show it are updated at the next frame. A change inside a list or struct needs the name of the whole.
set¶
function set(self, name: string, value: any): boolean
Sets a top-level field of the table and marks it dirty.
is_dirty¶
function is_dirty(self, name: string): boolean
Whether the field changed since the last frame updated the documents.
close¶
function close(self): ()
Removes the model. Close the documents that use it first.