local State = {}

setmetatable(State, {
  __call = function(_, name, transitions)
    local state = {}
    state.name = name
    state.transitions = transitions
    state.coroutine = nil -- the current coroutine
    -- Additional data
    state.data = {}

    return state
  end
})

return State
local State = {}

setmetatable(State, {
  __call = function(_, name, transitions, data)
    local state = {}
    state.name = name
    state.transitions = transitions
    state.coroutine = nil -- the current coroutine
    -- Additional data
    state.data = data or {}

    return state
  end
})

return State
Allow initialization of data when creating states
Allow initialization of data when creating states
