Code lua support tables

Hello! how can I know how many items are in a table?
I would like to know how many items are in my table, only the number

local inventory = {obj_1, obj_2, obj_3}

I want to do something like that

if inventory == 3 then
    print("There are ".. → 3 items) --example
elseif inventory == 0
print("There are no items")
end
if inventory == 10 then
    print("There are ".. #inventory) --example
end

You could put a # in front of the table.

1 Like

Thank you so much guys! it worked for me :smiley:

1 Like