--- title: function - Functions and callbacks summary: Functions can accept and return multiple values. A callback contract belongs to its exact event sender. Do not transfer one event signature to another. section: reference kind: guide status: reference updated: 2026-10-26 tags: ["API","X4"] 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"] --- ## Meaning Functions can accept and return multiple values. A callback contract belongs to its exact event sender. Do not transfer one event signature to another. ## Example ```lua local function read_pair() return "name", 2 end local name, count = read_pair() ``` **What happens:** name = "name", count = 2; one function returned two values. This fragment does not print or write a log message. The values shown are the expected results of the example. ## Methods and related calls [API reference](wiki:api-index).