Game Development Reference
In-Depth Information
Handling callbacks
A callback is essentially another Lua function that is stored as a variable. A helper function
iterates over all callbacks associated with a state and invokes them accordingly, passing an
additional data value along with the state name and whether the state is looping:
AnimationStateMachine.lua :
local function CallCallbacks(callbacks, stateName, looping)
for index = 1, #callbacks do
callbacks[index].callback(
stateName, looping, callbacks[index].data);
end
end
Search WWH ::




Custom Search