[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How reliable is lua_topointer() ?
- From: Lawrie Nichols <lawrien@...>
- Date: Tue, 11 Aug 2009 10:56:25 +0100
I'm looking at using the pointer returned from lua_topointer() as an
index into a weak-keyed table, but it's not obvious whether Lua might
ever change these pointers during the execution of my scripts (ie
whether a gc cycle might moving things around internally).
I'm guessing that for userdata, ghe pointer cannot be changed (since Lua
has no way of knowing the relevance of the data pointed to in the
userdata), but I'm not so sure whether this would hold true for
functions/tables.
I've had a look at the PiL on lua_topointer(), and all that says is that
the pointer cannot be used to to retrieve what was being pointed to.
To be honest, from trying it out, there doesn't seem to be any issues,
but I'd like to be sure.
Thanks
Lawrie