You will see that the passed arg is NOT used (I commented out the original code). optionalEdgeTemplate (Edge, Transition, whatever you wanna call it.) is passed from other functions as such... But used on this line (466) as optionalStateTemplate, which defaults to a global.
If overridden the function in my addon, but another work around would be to use optionalStateTemplate as a global before calling AddEdge.
I don't see it being used anywhere in the default UI, but I think we can all agree we don't like to see a bug in functions directly attached to the Crown store!
function ZO_StateMachine_Base:AddEdge(edgeName, fromState, toState, optionalEdgeTemplate, ...)
if type(fromState) == "string" then
fromState = self:GetStateByName(fromState)
if type(toState) == "string" then
toState = self:GetStateByName(toState)
-- Original ZOS code:
-- local template = optionalStateTemplate or ZO_StateMachine_Edge
-- Suggested Change:
local template = optionalEdgeTemplate or ZO_StateMachine_Edge
-- Other Workaround:
-- Treat optionalStateTemplate as a global before passing to AddEdge
local edge = template:New(fromState, toState, ...)
self.edges[edgeName] = edge