[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Self-referring userdata
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 24 Mar 2011 13:52:29 -0300
> Is there a better way? In other words, can I push the userdata on
> the stack given only the pointer to that userdata? That would be
> nnnnnice.
There is a simpler solution, but not that simpler. You can keep a
map from light userdata (the pointer to the userdata) to the
userdata themselves.
Nevertheless, this map still must be kept in a weak table if you want
Lua to colect the userdata. (But that seems dangerous if other parts of
your code keep a pointer to it.)
-- Roberto