Re: A way to associate a Lua value with a FFI pointer?

  • From: Javier Guerra Giraldez <javier@xxxxxxxxxxx>
  • To: LuaJIT <luajit@xxxxxxxxxxxxx>
  • Date: Wed, 9 Apr 2014 08:23:34 -0500

On Wed, Apr 9, 2014 at 4:51 AM, Daniel Kolesa <quaker66@xxxxxxxxx> wrote:
> 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 :)


as soon as you pass one of these pointers through a C function, or via
some kind of non-Lua-value channel, you'll get a different instance of
"the same" pointer, with a different cdata address and resolving to a
different hash slot.

it's safer to cast it to some Lua value.

-- 
Javier

Other related posts: