Name
HaveItem -- check if a table item exists (V6.0)
Synopsis
bool = HaveItem(t, key)
Function
This function checks whether the specified table has an item at index key or not. If there is an item at this index, HaveItem() will return True. This is a convenience function for RawGet().

Note that if you pass a string in the key parameter, it will be converted to lower case automatically. If you don't want that, use RawGet() instead.

Inputs
t
table to query
key
key to check
Results
bool
True or False depending on whether the item exists
Example
t = {x = 10, y = 20}
NPrint(HaveItem(t, "x"), HaveItem(t, "y"), HaveItem(t, "z"))
The code above will print 1 / 1 / 0 (= True, True, False).

Show TOC