Fix actions receiving nil instance

Action callbacks were being called with 'nil' instead of an instance. This commit fixes the action buffer type and passes 'instance' to the action callback.
This commit is contained in:
littensy 2023-08-27 19:39:54 -07:00 committed by GitHub
parent 4dc12e0157
commit f111105c5f
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]: () -> () } = {}
-- buffer of priority -> callback to run after events are connected
local action_buffers = {} :: { { () -> () } }
local action_buffers = {} :: { { (Instance) -> () } }
setmetatable(action_buffers :: any, {
__index = function(_, i: number)
action_buffers[i] = {}
@ -131,7 +131,7 @@ local function apply<T>(instance: T & Instance, properties: { [unknown]: unknown
-- run buffered actions respecting their priorities
for _, buffer in next, action_buffers do
for _, callback in next, buffer do
callback()
callback(instance)
end
end