[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lstrlib.c initialization - why createmetatable?
- From: Henk Boom <henk@...>
- Date: Sun, 18 Apr 2010 17:27:23 -0400
On 18 April 2010 11:18, Ralph Hempel <rhempel@bmts.com> wrote:
> That was the missing piece. Just create a dummy string and set the one
> and only metatable entry (__index) to nil allows the string library to
> be garbagecollected and removed from my special weak-keyed _LOADED
> registry table that I create in my main() before any of the standard
> libraries are loaded.
>
> More importantly, it allows me to reload the string library when I
> need to. Previous versions would not reload a library if it is already
> in _LOADED because the old __index metamethod was preventing the
> metatable from getting reclaimed.
What happens if 'string' is re-loaded before the garbage collector
runs, so that it is still in _LOADED?
henk