So I have a string that when I print it the output is: {1, 3}. However when I try to loop through that table it outputs this error: (table expected, got string). Is there any way to change that string back into a table? I tried tonumber but it didnt work. Could someone help me out here? Thanks!
Edit 1.
local function dumpTable(tableToDump)
local tbl = {}
if type(tableToDump) == "table" then
for i,v in pairs(tableToDump) do
table.insert(tbl, tostring(v))
end
return "{" .. table.concat(tbl, ", ") .. "}"
else
return nil
end
end
I did this because of the help of another scripting helper. Here is the link to that question. Here is the place I try to loop through the table:
local function findAMatch(savedItemsTable, item)
--if type(savedItemsTable) == "table" then
print("is a table")
for i,v in pairs(savedItemsTable) do
if v == item.ItemNumber.Value then
return true
else
return false
end
end
--else
--return false
--end
end
certain things are commented out just because it wasnt working and I wanted to see what was wrong. The if statement if it isnt commented out will not let the code continue because the type() of savedItemsTable is a string. Hope you guys can help. Thanks!

1 comment
Can you include the scripts you used.