lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Ando Sonenblick wrote:
How to find the key for a table value?  Since Lua doesn't keep this
information in the table, you must either search the table, or build
another table with the reverse mapping of values to keys.
Another thing: you mention that "Lua doesn't keep this information in the
table".  It doesn¹t ?   Now THAT seems odd.  Where does it keep it?

No. Nowhere.  ;)

What I meant by this is there is no pointer from the value to the key, and no way to find the value in the table without searching the table.

- Peter