Use generalized iteration everywhere

Closes #55
This commit is contained in:
centauri 2025-09-02 03:12:19 +01:00
parent a469094328
commit 9ace23470f
4 changed files with 7 additions and 7 deletions

View file

@ -133,8 +133,8 @@ local function apply<T>(instance: T & Instance, properties: { [unknown]: unknown
;(instance :: any)[event_name]:Connect(event_listener)
end
for _, queued in next, actions do
for _, callback in next, queued do
for _, queued in actions do
for _, callback in queued do
callback(instance)
end
end
@ -149,7 +149,7 @@ local function apply<T>(instance: T & Instance, properties: { [unknown]: unknown
end
table.clear(events)
for _, queued in next, actions do table.clear(queued) end
for _, queued in actions do table.clear(queued) end
caches.parent = nil
if flags.strict then table.clear(nested_debug) end
table.clear(nested_stack)

View file

@ -93,7 +93,7 @@ end
local function flush_cleanups<T>(node: Node<T>)
if node.cleanups then
for _, fn in next, node.cleanups do
for _, fn in node.cleanups do
local ok, err: string? = xpcall(fn, debug.traceback)
if not ok then error(`cleanup error: {err}`, 0) end
end

View file

@ -47,7 +47,7 @@ local function update_children_effect(p: {
cur_children_set[child] = nil -- remove child from cache if it was already in cache
end
elseif type(child) == "table" then
for _, child in next, child do
for _, child in child do
process_child(child)
end
elseif type(child) == "function" then
@ -70,7 +70,7 @@ local function update_children_effect(p: {
process_child(new_children)
for child in next, cur_children_set do
for child in cur_children_set do
child.Parent = nil -- unparent all children that weren't in the new children set
end

View file

@ -233,7 +233,7 @@ local function spring<T>(source: () -> T, period: number?, damping_ratio: number
end
local function step_springs(dt: number)
for data in next, springs do
for data in springs do
local k, c,
x0_123, x1_123, u_123,
x0_456, x1_456, u_456 =