widgets.watch_function
Observes the return value of an exact zero-argument widget function.
Syntax
ue.widgets.watch_function(widget: UObjectProxy, getter: string, callback: function, options?: table) -> integer?, string?Parameters
| Parameter | Type | Description |
|---|---|---|
widget | UObjectProxy | Widget to observe. |
getter | string | Exact zero-argument reflected function. |
callback | function(value, old_value, widget, id, name) | Called when the return value changes. |
options.immediate | boolean? | Deliver current value on the next tick. |
Returns
| Type | Description |
|---|---|
integer | Watch ID. |
nil, string | Getter was missing, requires arguments, or has no return value. |
Example
local id = assert(ue.widgets.watch_function(
widget,
"GetCurrentPage",
function(value)
print(value)
end
))Notes
- Requires a persistent session.