--- title: AddUITriggeredEvent summary: Lua UI → Mission Director: send screen, control and a payload. section: reference kind: api status: reference tags: ["X4","modding","add","ui","triggered","event"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/"] --- ## Return value | Type | Meaning | | --- | --- | | [`unknown`](wiki:type-results) | No return contract is established here. Sending an event does not prove that an MD action completed. | [Types and methods](wiki:types) ## Observed form Layer: game Lua UI. `screen` is the string matched by the MD receiver; `control` identifies the operation or control; `payload` is a supported value whose shape is validated by the receiver. ```lua AddUITriggeredEvent(screen, control, payload) ``` ## Example The MD side matches the same screen/control with `event_ui_triggered`. The contract used by this project reads the payload from `event.param3`. ```lua AddUITriggeredEvent("WikiBridge", "ping", "hello") ``` **What happens:** An event is sent with screen = "WikiBridge", control = "ping" and payload = "hello". A matching MD receiver can read it as event.param3; sending alone does not print a message. ## Limits Sending does not prove that the receiver is ready, the action is authorized or the effect occurred. Register the reply receiver first and use a request ID for acknowledged operations. Serialization depends on supported game types; arbitrary userdata or another process's runtime handle is not a ready-to-use object. See the complete [Lua ↔ MD example](wiki:md-lua-bridge).