Skip to content

Commit 31ec216

Browse files
authored
Remove pairs() and ipairs() (#1150)
1 parent ea70d89 commit 31ec216

File tree

13 files changed

+17
-17
lines changed

13 files changed

+17
-17
lines changed

plugin/fmt/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
local function defaultTableDebug(buffer, input)
2626
buffer:writeRaw("{")
2727

28-
for key, value in pairs(input) do
28+
for key, value in input do
2929
buffer:write("[{:?}] = {:?}", key, value)
3030

3131
if next(input, key) ~= nil then
@@ -50,7 +50,7 @@ local function defaultTableDebugExtended(buffer, input)
5050
buffer:writeLineRaw("{")
5151
buffer:indent()
5252

53-
for key, value in pairs(input) do
53+
for key, value in input do
5454
buffer:writeLine("[{:?}] = {:#?},", key, value)
5555
end
5656

plugin/src/App/bindingUtil.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444
local function blendAlpha(alphaValues)
4545
local alpha = 0
4646

47-
for _, value in pairs(alphaValues) do
47+
for _, value in alphaValues do
4848
alpha = alpha + (1 - alpha) * value
4949
end
5050

plugin/src/Assets.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ local Assets = {
7474
local function guardForTypos(name, map)
7575
strict(name, map)
7676

77-
for key, child in pairs(map) do
77+
for key, child in map do
7878
if type(child) == "table" then
7979
guardForTypos(("%s.%s"):format(name, key), child)
8080
end

plugin/src/ChangeBatcher/createPatchSet.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local encodePatchUpdate = require(script.Parent.encodePatchUpdate)
1515
return function(instanceMap, propertyChanges)
1616
local patch = PatchSet.newEmpty()
1717

18-
for instance, properties in pairs(propertyChanges) do
18+
for instance, properties in propertyChanges do
1919
local instanceId = instanceMap.fromInstances[instance]
2020

2121
if instanceId == nil then

plugin/src/ChangeBatcher/encodePatchUpdate.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ return function(instance, instanceId, properties)
1010
changedProperties = {},
1111
}
1212

13-
for propertyName in pairs(properties) do
13+
for propertyName in properties do
1414
if propertyName == "Name" then
1515
update.changedName = instance.Name
1616
else

plugin/src/Dictionary.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local function merge(...)
1414
local source = select(i, ...)
1515

1616
if source ~= nil then
17-
for key, value in pairs(source) do
17+
for key, value in source do
1818
if value == None then
1919
output[key] = nil
2020
else

plugin/src/InstanceMap.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function InstanceMap:__fmtDebug(output)
6363
-- Collect all of the entries in the InstanceMap and sort them by their
6464
-- label, which helps make our output deterministic.
6565
local entries = {}
66-
for id, instance in pairs(self.fromIds) do
66+
for id, instance in self.fromIds do
6767
local label = string.format("%s (%s)", instance:GetFullName(), instance.ClassName)
6868

6969
table.insert(entries, { id, label })
@@ -73,7 +73,7 @@ function InstanceMap:__fmtDebug(output)
7373
return a[2] < b[2]
7474
end)
7575

76-
for _, entry in ipairs(entries) do
76+
for _, entry in entries do
7777
output:writeLine("{}: {}", entry[1], entry[2])
7878
end
7979

@@ -227,7 +227,7 @@ function InstanceMap:__disconnectSignals(instance)
227227
-- around the extra table. ValueBase objects force us to use multiple
228228
-- signals to emulate the Instance.Changed event, however.
229229
if typeof(signals) == "table" then
230-
for _, signal in ipairs(signals) do
230+
for _, signal in signals do
231231
signal:Disconnect()
232232
end
233233
else

plugin/src/Reconciler/diff.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ local function trueEquals(a, b): boolean
3838
-- For tables, try recursive deep equality
3939
if typeA == "table" and typeB == "table" then
4040
local checkedKeys = {}
41-
for key, value in pairs(a) do
41+
for key, value in a do
4242
checkedKeys[key] = true
4343
if not trueEquals(value, b[key]) then
4444
return false
4545
end
4646
end
47-
for key, value in pairs(b) do
47+
for key, value in b do
4848
if checkedKeys[key] then
4949
continue
5050
end

plugin/src/Reconciler/diff.spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ return function()
1414
local function size(dict)
1515
local len = 0
1616

17-
for _ in pairs(dict) do
17+
for _ in dict do
1818
len = len + 1
1919
end
2020

plugin/src/Reconciler/hydrate.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ local function hydrate(instanceMap, virtualInstances, rootId, rootInstance)
2626
for _, childId in ipairs(virtualInstance.Children) do
2727
local virtualChild = virtualInstances[childId]
2828

29-
for childIndex, childInstance in ipairs(existingChildren) do
29+
for childIndex, childInstance in existingChildren do
3030
if not isExistingChildVisited[childIndex] then
3131
-- We guard accessing Name and ClassName in order to avoid
3232
-- tripping over children of DataModel that Rojo won't have

0 commit comments

Comments
 (0)