Windower Lua API - Windower/Lua GitHub Wiki

This page will give an overview over Windower's Lua API and the available libraries as well as the events triggered by it.

Lua

Lua is a programming language focused on easy embedding, which is why it's found in various games these days as the scripting language of choice.

The Lua version used by Windower is 5.1, and its manual can be used to look up various Lua-native functions. For Windower-specific functions see the API reference below.

One thing to note is that we don't use stock Lua, but a slightly modified version. We use a superset of actual Lua 5.1, meaning everything that's valid Lua will also be valid for us, but additionally we support a few more things. Here is a list of all modifications we made to the language:

Operators

We adjusted the parser to allow for a unary plus. The following is allowed and will print 3, but it would be a syntax error in stock Lua:

print(+3)

Similarly we have added the __unp metamethod for the unary plus (just like __unm is used for the unary minus).

Grammar

We adjusted the parser to allow indexing and calling literal values (literal strings, tables, bools, numbers, functions and nil). The following is a valid stock Lua line:

x = ('string: %s, number: %d'):format('foo', 42)

However, the parentheses around the formatting string are required. With our modification the parentheses around literals can be dropped, allowing this (which would be a parsing error in stock Lua):

x = 'string: %s, number: %d':format('foo', 42)

API

  • Events - Events that are triggered and can be handled by addons
  • Functions - Functions provided by Windower
  • Libraries - Available libraries that can be included