forked from rojo-rbx/rojo
Remove pairs() and ipairs() (#1150)
This commit is contained in:
@@ -38,13 +38,13 @@ local function trueEquals(a, b): boolean
|
||||
-- For tables, try recursive deep equality
|
||||
if typeA == "table" and typeB == "table" then
|
||||
local checkedKeys = {}
|
||||
for key, value in pairs(a) do
|
||||
for key, value in a do
|
||||
checkedKeys[key] = true
|
||||
if not trueEquals(value, b[key]) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for key, value in pairs(b) do
|
||||
for key, value in b do
|
||||
if checkedKeys[key] then
|
||||
continue
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ return function()
|
||||
local function size(dict)
|
||||
local len = 0
|
||||
|
||||
for _ in pairs(dict) do
|
||||
for _ in dict do
|
||||
len = len + 1
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ local function hydrate(instanceMap, virtualInstances, rootId, rootInstance)
|
||||
for _, childId in ipairs(virtualInstance.Children) do
|
||||
local virtualChild = virtualInstances[childId]
|
||||
|
||||
for childIndex, childInstance in ipairs(existingChildren) do
|
||||
for childIndex, childInstance in existingChildren do
|
||||
if not isExistingChildVisited[childIndex] then
|
||||
-- We guard accessing Name and ClassName in order to avoid
|
||||
-- tripping over children of DataModel that Rojo won't have
|
||||
|
||||
@@ -126,7 +126,7 @@ function applyDeferredRefs(instanceMap, deferredRefs, unappliedPatch)
|
||||
})
|
||||
end
|
||||
|
||||
for _, entry in ipairs(deferredRefs) do
|
||||
for _, entry in deferredRefs do
|
||||
local _, refId = next(entry.virtualValue)
|
||||
|
||||
if refId == nil then
|
||||
|
||||
@@ -12,7 +12,7 @@ return function()
|
||||
local function size(dict)
|
||||
local len = 0
|
||||
|
||||
for _ in pairs(dict) do
|
||||
for _ in dict do
|
||||
len = len + 1
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user