Added tContains and tDeleteItem

This commit is contained in:
Brues
2026-06-21 16:44:49 -05:00
parent 4263bae064
commit 11191e8d4c
+21
View File
@@ -65,6 +65,18 @@ function CreateTableReverseEnumerator(tbl, minIndex, maxIndex)
return Enumerator, tbl, maxIndex
end
function tDeleteItem(tbl, item)
local size = #tbl;
local index = size;
while index > 0 do
if item == tbl[index] then
tRemove(tbl, index);
end
index = index - 1;
end
return size - #tbl;
end
function tIndexOf(tbl, item)
for i, v in ipairs(tbl) do
if item == v then
@@ -73,6 +85,15 @@ function tIndexOf(tbl, item)
end
end
function tContains(tbl, item)
for k, v in pairs(tbl) do
if item == v then
return true;
end
end
return false;
end
function TableUtil.ContainsAllKeys(lhsTable, rhsTable)
for key, _ in pairs(lhsTable) do
if rhsTable[key] == nil then