function StateHolder._callTransitionCallbacks(X,n,I)local r=X._callbacks.global if r then local t=r.onLeave local u=r.onEnter if t then t(X,n,I)end if u then u(X,n,I)end end local t=X._callbacks[n]if t and t.onLeave then t.onLeave(X,n,I)end local u=X._callbacks[I]if u and u.onEnter then u.onEnter(X,n,I)end end
--[[
    Checks call backs on transition from, to, and calls them if they exist.
]]
function StateHolder:_callTransitionCallbacks(from, to)
	local globalCallback = self._callbacks.global

	if globalCallback then
		local globalLeave = globalCallback.onLeave
		local globalEnter = globalCallback.onEnter

		if globalLeave then
			globalLeave(self, from, to)
		end

		if globalEnter then
			globalEnter(self, from, to)
		end
	end

	local fromCallbacks = self._callbacks[from]

	if fromCallbacks and fromCallbacks.onLeave then
		fromCallbacks.onLeave(self, from, to)
	end

	local toCallbacks = self._callbacks[to]

	if toCallbacks and toCallbacks.onEnter then
		toCallbacks.onEnter(self, from, to)
	end
end
