Re: CDATA as table keys

  • From: Mike Pall <mike-1411@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 11 Nov 2014 19:34:02 +0100

Meae Flowright wrote:
> Am I safe to use structs or unions as objects? Do I need to worry about the
> address changing spontaneously, or similar structs re-using an address?

If you only deal with structs and want equality-by-address
semantics, then yes, this is safe. The addresses of cdata objects
don't change.

[The paragraph in the docs mainly deals with cdata objects that
generally provide equality-by-value semantics, except when used as
hash table keys. I.e. cdata numbers and pointers.]

--Mike

Other related posts: