How would you print() out or find out the index of an object?
For example, if I spawned 20 random rock objects on screen into an array RockTable = {};<
RockTable = {};
Invert the table:
function table_invert(t) local u = { } for k, v in pairs(t) do u[v] = k end return u end
You can then use the inverted table to find the index.
I find this function so useful that it goes into my permanent "Lua utilities" libraries.