Home › Engine Lua tables › Event objects

Engine executable. Settings and tools of the game program (CivilizationVI.exe), usable without a mod. Mostly undocumented debug and configuration functionality; descriptions come from analysis of the executable and have not all been tried in the running game.

Event objects

Every Lua event (Events.Name, LuaEvents.Name) is an object the exe creates and equips with the same seven methods. The exe registers 465 such objects, one per event, each with its own copy of the methods. The event names and their parameters are in the Lua events list of the GameCore reference; this page only describes the methods every event object has. All of this is inferred from the registration code and the error messages inside the exe.

Method What it does (inferred)
Add(function, [dispatch_count]) Register a handler. The exe's own message: Invalid number of arguments. Add(function, [dispatch_count]); a dispatch_count of 0 is rejected (Argument 2 must not be 0.). The optional count is probably how many times the handler runs before it is removed.
Remove(function) Unregister a handler (Invalid number of arguments. Remove(function)).
RemoveAll() Remove every handler of the event.
Call(...) Raise the event with the given arguments.
CallImmediate(...) Raise the event and run the handlers immediately (the name suggests Call may defer).
Dispatch(...) Deliver queued calls to the handlers.
Count() Number of registered handlers.

Handlers are Lua functions; the first argument to Add is checked as a function (luaL_checktype ... function).