lua-users home
lua-l archive

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


> If you want some C function to receive z and change x by accessing the
> memory location it points to, you need to do this, because if z is another
> full userdata, it is in a different memory location.

Say I were to do this, what function would I call to put the address on the
lua stack? Is it lua_pushlightuserdata? This has the correct signature
(putting a void* on the stack, and lua_newuserdata returns void*) but it
seems incorrect to push full userdata with lua_pushlightuserdata.

> You could do something
> else though: when x is created, store an entry in the registry where y is
> the key and x the value: then instead of passing y to func_b, retrieve x
> from y in the registry and pass this instead.

That seems to be a very good solution. I am not sure whether I will be able
to use it in this context, but it might be useful in other cases.

Thank you,
Steven Murdoch.