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

  • From: Daniel Kolesa <quaker66@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 9 Apr 2014 10:31:27 +0100

The address in C stays constant, so there should be no problem with using
cdata as a key here.


2014-04-09 10:26 GMT+01:00 Richard Hundt <richardhundt@xxxxxxxxx>:

> On 4/9/14 11:20 AM, Daniel Kolesa wrote:
> > Right, but p1's address stays the same - what I meant is you could do
> > reg[ptr] = val and return reg[ptr] directly.
>
> Sure, as long as you can be sure that you're passing around the *same*
> pointer value, where *same* is not what in C you'd think of as the same.
> Otherwise it'll bite. But as I said, I don't know your full use case.
>
>
>

Other related posts: