Merge pull request #5 from littensy/patch-1

Fix actions receiving nil instance
This commit is contained in:
Aaron 2023-08-28 12:15:13 +01:00 committed by GitHub
commit 374593029a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ type Node<T> = graph.Node<T>
local event_buffer: { [string]: () -> () } = {} local event_buffer: { [string]: () -> () } = {}
-- buffer of priority -> callback to run after events are connected -- buffer of priority -> callback to run after events are connected
local action_buffers = {} :: { { () -> () } } local action_buffers = {} :: { { (Instance) -> () } }
setmetatable(action_buffers :: any, { setmetatable(action_buffers :: any, {
__index = function(_, i: number) __index = function(_, i: number)
action_buffers[i] = {} action_buffers[i] = {}
@ -131,7 +131,7 @@ local function apply<T>(instance: T & Instance, properties: { [unknown]: unknown
-- run buffered actions respecting their priorities -- run buffered actions respecting their priorities
for _, buffer in next, action_buffers do for _, buffer in next, action_buffers do
for _, callback in next, buffer do for _, callback in next, buffer do
callback() callback(instance)
end end
end end