Skip to content

Commit

Permalink
Use generalized iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ukendio committed Dec 26, 2024
1 parent 76aef4f commit edb73ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions demo/src/ServerScriptService/systems/mobs.luau
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ local moving_mobs = world
local function mobsMove(dt: number)
local targets = {}

for _, character in characters:iter() do
for _, character in characters do
table.insert(targets, (character.PrimaryPart :: Part).Position)
end

for mob, transform, v in moving_mobs:iter() do
for mob, transform, v in moving_mobs do
local cf = transform.new
local p = cf.Position

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local Transform = cts.Transform

local moving_models = world:query(Transform, Model):cached()
local function move(dt: number)
for _, transform, model in moving_models:iter() do
for _, transform, model in moving_models do
local cf = transform.new
if cf ~= transform.old then
local part = model.PrimaryPart :: BasePart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ end

local q = world:query(A, B, C, D):cached()
local function cached()
for _ in q:iter() do
for _ in q do
end
end

Expand Down

0 comments on commit edb73ca

Please sign in to comment.