Legacy Lua API documentation

Welcome to the Legacy Lua API’s documentation!

The Legacy mod is the default mod shipped with ET: Legacy. It supports server-side modifications via the Lua scripting language, with the Legacy Lua API being the interface for communication between them.

The embedded Lua 5.4 interpreter will load user-defined scripts if present in the legacy directory. The Lua API provides an “et” library of function calls that allow access to the server engine, and also provides callbacks so a server side mod may trigger on specific server events.

In some cases values can be returned to Legacy mod, whenever something is intercepted (i.e. a command) and prevented to be further handled. This way, new commands can easily be defined or existing ones can be altered.

Through special functions, it is also possible to alter internal structures or entities (manipulate client XP, set and read cvars, remap shaders, etc.). For example, if a player dies the et_Obituary( victim, killer, meansOfDeath ) function is executed, and the Lua API allows you to manipulate and control this information.

Note

Like qagame, Lua modules are unloaded and reloaded on map_restart and map changes, which means that all global variables and other information is lost. Persistent data can be stored in cvars, external files or database.

Legacy’s Lua API follows mostly the ETPub implementation with partial code of the NoQuarter implemention. The ETPub implementation being built to be compatible with ETPro’s Lua, all scripts written in ETPro’s documentation should be valid and more or less compatible with Legacy mod’s Lua API.

Important

As Legacy uses the newer Lua 5.4, you might want to check the Incompatibilities with the Previous Version sections of the Lua 5.1, Lua 5.2, Lua 5.3, and Lua 5.4 manuals while porting scripts written for other mods.