lua-users home
lua-l archive

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


The garbage collector will figure out by itself. When there are no more references to a lua value, it will be garbage collected. So you have to explicitly remove all references to objects created by the loading of your file. If you use modules in the Lua 5.1 package model, loaded with a call to require, you can do:

package.loaded["module.name"] = nil

Make sure you use the exact same string you passed to require. Even if there are submodules in your module name, there are no subtables to package.loaded.

-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Rafael de Menezes
Envoyé : 25 octobre 2006 08:40
À : Lua list
Objet : Re: How to unload script.

What say to GC that the some.lua wasn't usefull again? Time? The code expire?




----- Original Message -----
From: "cloudwu" <cloudwu@163.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Wednesday, October 25, 2006 9:51 AM
Subject: Re: How to unload script.


> Hello L,
>
> Wednesday, October 25, 2006, 2:38:37 PM, you wrote:
>
> Lk> Hi, every
> Lk> guys:
> Lk> 牋?When i use luaL_loadfile("some.lua"), and i called aux_do(). but 
> Lk> right now, i wanna to unload the "some.lua"
script
> Lk> buffer, and free all objects defined in "some.lua".?
>
> Lk> how to do this? anyone ,please give me some help.
>
> You don't need unload it, gc system will do.
>
> --
> Best regards,
>  cloudwu                            mailto:cloudwu@163.com
>             http://blog.codingnow.com
>
> [This will pass too]
>
>
>