When using a callback function with RegisterForEvent, is there a way I can specify a parameter that the callback uses? For example:
Lua Code:
EVENT_MANAGER:RegisterForEvent(BarTracker.name, EVENT_ACTION_LAYER_PUSHED, BarTracker.toggleVisibility)
function BarTracker.toggleVisibility(hidden)
BarTracker.guiWindow:SetHidden(hidden)
end
I can't simply pass BarTracker.toggleVisibility(true) as the 3rd parameter since that immediately invokes the function. In JavaScript, I could use bind or the syntax (() => BarTracker.toggleVisibility(true)) since that won't invoke it, but still passes the parameter when the callback is called. Does Lua have something similar? I don't know exactly what this is called so I couldn't find anything on SO.