And this is the code that loops through the table.
local function checkItem(itemId, list)
for _, item in ipairs(list) do
print(item, itemId)
if item['ItemId'] == itemId then
return true
else
return false
end
end
end
This shows am image of what the table would look like printed. The 2 in the line 88 is the Item Id or iteration it should be at. The script only returns the first iteration of the table.
The function stops at the first entry of the table and I can’t get it to iterate past this. Is there any way I can? How would I be able to do it if there is?
local function checkItem(itemId, list)
for _, item in list do
print(item, itemId)
if item['ItemId'] == itemId then
return true
else
return false
end
end
end
It is because you are returning the function before it can loop through everything in the table.
local function checkItem(itemId, list)
for _, item in ipairs(list) do
print(item, itemId)
if item['ItemId'] == itemId then
return true
end
end
return false
end