How to unload script.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to unload script.

L kevin

Hi, every guys:
    When i use luaL_loadfile("some.lua"), and i called aux_do(). but right now, i wanna to unload the "some.lua" script buffer, and free all objects defined in "some.lua". 

how to do this? anyone ,please give me some help.




kevin.L



使用世界上最大 的电子邮件系统― MSN Hotmail
Reply | Threaded
Open this post in threaded view
|

Re: How to unload script.

Cloud Wu
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 
Lk> called aux_do(). but 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 
Lk> help.

You don't need unload it, gc system will do.

-- 
Best regards,
 cloudwu                            [hidden email]
            http://blog.codingnow.com

[This will pass too]



Reply | Threaded
Open this post in threaded view
|

Re: How to unload script.

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




----- Original Message -----
From: "cloudwu" <[hidden email]>
To: "Lua list" <[hidden email]>
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
> Lk> called aux_do(). but 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
> Lk> help.
>
> You don't need unload it, gc system will do.
>
> --
> Best regards,
>  cloudwu                            [hidden email]
>             http://blog.codingnow.com
>
> [This will pass too]
>
>
>


Reply | Threaded
Open this post in threaded view
|

RE: How to unload script.

Ram Firestone
In reply to this post by L kevin
If you assign everything it loads to nil the garbage collector will get rid of them 
for you assuming you haven't generated any other references to them. 

For instance, say in your file you have:

Function foo (par)
  ...
  ...
end

you can later do a:

foo = nil 

________________________________________
From: [hidden email] [[hidden email]] On Behalf Of L kevin
Sent: Tuesday, October 24, 2006 11:39 PM
To: [hidden email]
Subject: How to unload script.

Hi, every guys:
    When i use luaL_loadfile("some.lua"), and i called aux_do(). but right now, i wanna to unload the "some.lua" script buffer, and free all objects defined in "some.lua".  
how to do this? anyone ,please give me some help.


kevin.L


________________________________________
äçäçäæå ççåéäççâ MSN Hotmail 



Reply | Threaded
Open this post in threaded view
|

Re: How to unload script.

Paul Hudson-2
In reply to this post by Rafael - SosCpdTerra
The GC will free it when nothing else references it.

----- Original Message -----
From: "Rafael de Menezes" <[hidden email]>
To: "Lua list" <[hidden email]>

What say to GC that the some.lua wasn't usefull again? Time? The code
expire?
----- Original Message -----
From: "cloudwu" <[hidden email]>
To: "Lua list" <[hidden email]>

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
Lk> called aux_do(). but 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
Lk> help.

You don't need unload it, gc system will do.


Reply | Threaded
Open this post in threaded view
|

RE: How to unload script.

Jerome Vuarand-2
In reply to this post by Rafael - SosCpdTerra
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 : [hidden email] [[hidden email]] 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" <[hidden email]>
To: "Lua list" <[hidden email]>
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                            [hidden email]
>             http://blog.codingnow.com
>
> [This will pass too]
>
>
>