How to trigger things with ESO's default code
From ESOUI Wiki
You can react to scene changes (scenes being "hud", "hudui", "inventory", "bank"...). See here.
What is it?
There are two ways to attach your function to another: Hook and Callback.
While you can completely overwrite most default functions, that is an excellent way to break everyone else's AddOn.
Please hook responsibly!
[Hooking] takes advantage of the fact that a function is a variable in the object that calls it.
To make use of it, we take the original function, save it to a local variable, then overwrite the function and include a call to our local variable.
An example from SurveyTheWorld: I hook the function that sets the location control data when opening the world map.
local orgFunction = WORLD_MAP_LOCATIONS.SetupLocation function WORLD_MAP_LOCATIONS:SetupLocation(rowControl, rowData) if rowControl then rowData.locationName = "I like " .. rowData.locationName end orgFunction(self, rowControl, rowData) end
This will prefix the name of every zone on your world map with "I like " -> "Deshaan" will be "I like Deshaan".
Depending on when orgFunction(self, rowControl, rowData) is ran, your code will be executed before or after.
In LUA, object:function(args) is equivalent to object.function(self, args).
In ESO source, most functions will be called in colon notation and require you to pass the object as first parameter.