Call as
Functions.collections.compareArray(lhs, rhs)
Record it as a dependency named Functions.collections.compareArray (accepting the completion does this), then call it by that name.
What it does
Visit entries in both tables and compare each value with the indexed value in the other table using Lua equality. Normal indexing and equality metamethods apply; nested contents are not compared recursively.
Arguments
| Name | Type | What it does |
|---|---|---|
lhs | table | First table to compare. |
rhs | table | Second table to compare. |
Returns
| 1 | boolean | True when every visited entry compares equal in both directions. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
Example
local wanted = { "Moonfire", "Sunfire" }
local applied = { "Moonfire", "Sunfire" }
return Functions.collections.compareArray(wanted, applied)Source
Functions/collections.lua, line 172. Read only in game; Duplicate makes an editable copy.
Functions.collections.compareArray(lhs, rhs)
for k,v in pairs(lhs) do
if rhs[k] ~= v then
return false
end
end
for k,v in pairs(rhs) do
if lhs[k] ~= v then
return false
end
end
return true