vide/src/action.luau
Aaron Smith c288cb92c4 Minor refactors
Also fixed potential bug with `create()` being called recursively if a
property binding passed as a property to `create()` also calls
`create()`
2023-11-20 16:53:30 +00:00

25 lines
466 B
Text

type Action = {
priority: number,
callback: (Instance) -> ()
}
local ActionMT = table.freeze {}
local function is_action(v: any)
return getmetatable(v) == ActionMT
end
local function action(callback: (Instance) -> (), priority: number?): Action
local a = {
priority = priority or 1,
callback = callback
}
setmetatable(a :: any, ActionMT)
return table.freeze(a)
end
return function()
return action, is_action
end