--[[
    Initialises a new StateHolder from defined config table, which should be formatted as below:
    allowedTransitions = {
        [StateName] = {} -- Within the table should be all the states this state can transition into
    }
    callbacks = {
		global = {onLeave = function(stateHolder, from, to), onEnter = function(stateHolder, from, to)}
        [StateName] = {onLeave = function(stateHolder, from, to), onEnter = function(stateHolder, from, to)}
    }
    initial -- Optional initial state to automatically transition into
]]

function StateHolder:_init(config)
	self._allowedTransitions = config.allowedTransitions
	self._callbacks = config.callbacks

	if config.initial then
		spawn(
			function()
				self:transition(config.initial, true)
			end
		)
	end
end
