Table.find not finding value in table

I am trying to use table.find to find a GUID value in an array of tables. Below I paste the code and a screenshot of the print results.

function InventoryService:FindItemByGUID(myTable, GUID)

    local resuts = table.find(myTable, GUID)

    print("GUID to find: ", GUID)
    print("table to find in: ", myTable)
    print("results of table.find", results)


here is a screenshot of the resulting prints, you can see the GUID is in fact stored in one of the tables.

What i need is to get the array index of the table that has this GUID in. I can of course use a more iterative approach but I thought i would give table.find for the first time.


1 Like

You would have to loop through each table and get the GUID index.
table.find only works for arrays, not dictionaries


table.find only looks for values in the passed array, if this array has another array as a value table.find won’t pick this up.

An example of how to use table.find is:

local myArray = {

local index = table.find(myArray[3], “Hello”)

I understand now, thanks to all for helping!

1 Like