Yes, I know this. But that's not relevant in my case and the cases you're showing do not happen in my particular situation :) 2014-04-09 10:47 GMT+01:00 Richard Hundt <richardhundt@xxxxxxxxx>: > On 4/9/14 11:31 AM, Daniel Kolesa wrote: > > The address in C stays constant, so there should be no problem with > > using cdata as a key here. > > That the address in C stays constant doesn't mean much. That's my point. > > ```C > int is_equal(char* a, char* b) { > return a == b; > } > ``` > > ```Lua > a = ffi.new('char[1]') > b = ffi.cast('char*', a) > > assert(ffi.C.is_equal(a, b) == 1) > > assert(a == b) -- even this works (git head) > t = { } > t[a] = 42 > assert(t[b] == nil) -- yep > ``` > > That C function cannot tell the difference between `a` and `b` because > the addresses are the same. However, even so, you can't use `b` as a key > where previously you used `a`. > > Maybe you already know all this, and I'm just making a noise, but > perhaps somebody else who's reading this can benefit. It crops up > occasionally. > > > >