Skip to content
zetaepyon edited this page Jul 1, 2018 · 3 revisions

This section contains reference information about the custom Lua libraries available with Windower.

About Function Signatures

Function signatures in the Library Reference are specified using TypeScript syntax. This results in an appearance that is similar to standard Lua, but with some additional information about parameter types and default values.

Example: ui.button TypeScript function signature

function ui.button(id : string, text : string, checked : boolean = false, enabled : boolean = true) : boolean

From this example, we can see that the function takes four parameters:

  • id : a string
  • text : a string
  • checked : an optional boolean value that defaults to false
  • enabled : an optional boolean value that defaults to true

We can also see that the function itself returns a single boolean value.

By removing all the additional TypeScript information from the signature, we are left with valid Lua syntax. For example, removing : string from the id parameter, and so on, gives us this:

Example: ui.button signature, with TypeScript additions removed

function ui.button(id, text, checked, enabled)

This function definition can be used to assign the return value to a variable in standard Lua:

Example: ui.button Lua usage

local button_checked = ui.button(id, text, checked, enabled)
Clone this wiki locally