VE Lua Documentation

Press F to search!

setEqual

Definition


-- @/lua/common/utils.lua:507

--MARK: Table utils

function setEqual(set1, set2)
  if #set1 ~= #set2 then return false end
  local lut = tableValuesAsLookupDict(set1)
  for _, val in ipairs(set2) do
    if not lut[val] then return false end
  end
  return true
end

Callers

@/lua/ge/extensions/editor/api/objectHistoryActions.lua
local function selectObjectsWithUndo(newSelection, oldSelection)
  if newSelection and oldSelection and setEqual(newSelection, oldSelection) then return end
  -- check top of undo stack to see if we have the same selection, if so, dont add
    if action.name == "SelectObjects" then
      if action.newSelection and newSelection and setEqual(action.newSelection, newSelection) then return end
    end
@/lua/ge/extensions/flowgraph/nodes/gameplay/decalLine.lua
    if pin.type == 'color' then
      if not self.colorCache[k] or (self.pinIn[k].value and not setEqual(self.colorCache[k], self.pinIn[k].value)) then
        self.colorCache[k] = deepcopy(self.pinIn[k].value or pin.default)
@/lua/ge/extensions/flowgraph/nodes/gameplay/decalCircle.lua
    if pin.type == 'color' then
      if not self.colorCache[k] or (self.pinIn[k].value and not setEqual(self.colorCache[k], self.pinIn[k].value)) then
        self.colorCache[k] = deepcopy(self.pinIn[k].value or pin.default)
@/lua/ge/extensions/editor/inspector.lua

  if not setEqual(valueInspector.selectedIds, inspectorInfo.previousSelectedIds) then
    imgui.ClearActiveID()
@/lua/ge/extensions/editor/roadEditor.lua
      -- If the set of hovered roads has changed, use the last hovered road if possible, or else number 1
      elseif not setEqual(hoveredRoadsIDs, hoveredRoadsIDsCopy) then
        local oldIndex = indexOf(hoveredRoadsIDs, lastHoveredRoadID)