3 ms·
Lua tables are more interesting than that. You can have an table that is indexed by any supported type. That means tables indexed by positive or negative intege
by bdowling 10y ago
Lua tables are more interesting than that. You can have an table that is indexed by any supported type. That means tables indexed by positive or negative integers, floating point values, references to other objects or other tables, true, false, strings, coroutines, and external memory references can all be indexes. You can also have a single table indexed by any combination of these.
- eternalban 10y agoIsn't that technically a hashtable and not an array?
- bdowling 10y agoIn Lua the same data structure is used for both. The implementation optimizes the data structure like an array when you use a range of non-negative integers as indexes.