--- title: API reference summary: Lua UI calls, C / FFI declarations, MD actions and events with established parameter and result types. section: reference kind: guide status: reference updated: 2026-10-26 tags: ["X4","modding","api","index"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/","https://www.lua.org/manual/5.1/manual.html","https://luajit.org/ext_ffi_api.html"] --- ## How to use it Expand a category and library or subsystem in the sidebar, then select a name. Each entry has a dedicated page. Search opens the same page. Catalogue rows show return types; established types link to explanations. Start with [types, results and methods](wiki:types). unknown means an unestablished contract; none means no direct return. ## Categories | Area | Open | | --- | --- | | X4 Lua UI calls | [Lua API](wiki:catalog-lua) | | C declarations, parameters and returns | [FFI](wiki:catalog-ffi) | | XML actions and constructs | [MD / AI](wiki:catalog-md) | | Event conditions and filters | [MD / AI events](wiki:catalog-md-events) | | Lua UI events | [Lua events](wiki:catalog-lua-events) | | Helper and menu methods | [UI Helper](wiki:catalog-helper) | | Base functions and libraries | [Lua and LuaJIT](wiki:catalog-standard) | This is a growing reference of known interfaces, rather than the complete X4 SDK. [Evidence limits](wiki:catalog-guide) explain what a declaration establishes. ## First calls [AddUITriggeredEvent](wiki:add-ui-triggered-event) sends to MD, [RegisterEvent](wiki:register-event) installs a Lua callback, and [GetComponentData](wiki:get-component-data) reads requested component fields. ## First MD elements [event_ui_triggered](wiki:event-ui-triggered) receives a UI event, [raise_lua_event](wiki:raise-lua-event) sends a value to Lua, and [set_value](wiki:set-value) writes a variable. MD has its own types and expressions. [neededbuildresources](wiki:needed-build-resources) illustrates an MD property and a build task resource shortage table. ## Continue with practice [X4 code basics](wiki:x4-code-basics), [Lua / MD bridge](wiki:md-lua-bridge), [changing properties](wiki:editing-parameters), [creating UI](wiki:create-ui).