[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Prevent userdata from being marked for garbage collection?
- From: Carsten Fuchs <carsten.fuchs@...>
- Date: Wed, 04 Jul 2012 21:52:44 +0200
Hi Peter,
Am 2012-07-04 00:37, schrieb Peter Cawley:
[...] look at the sweeplist function in lgc.c, and have it
resurrect userdata which are otherwise dead.
Alternatively, if you're willing to take advantage of some
implementation warts, you can resurrect objects from their __gc
handler. [...]
To round off, it probably doesn't need saying, but the cleanest
approach would be to work within the existing metamethods and garbage
collection semantics.
Thanks for pointing me to the relevant internals!
If anyhow possible, I'd prefer to find a clean and stable solution that works with Lua
unmodified and as officially documented, so I'll check out these approaches first.
If that fails, I'll happily start studying the Lua internals though (something that I've
long been planning and looking forward to do, but have never been able to find enough
time for).
(And well, honestly, despite my rather fruitless prior web searches, I secretly hoped
that I was not the only or first one to ask for a __mask-like callback, and that someone
with more knowledge than me had found a solution before...)
Still, many thanks for your help!
Best regards,
Carsten
--
Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
Learn more at http://www.cafu.de