lua-users home
lua-l archive

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

Leigh, assuming I have the jist of your question, functions are first
class values in Lua, which means they are objects like anything else.

function foo()

foo = nil -- will release the function body (then GC)

Functions are just closures of Lua code assigned to a variable name.

I put some more details in the tutorial:

You could however just define your functions in a table and delete this,

config = {
   width = 640,
   height = 480


-- if none of table contents are referenced anywhere else, this will
-- the functions as well.
config = nil  


> -----Original Message-----
> From: Leigh McRae []
> Sent: Wednesday, October 22, 2003 7:06 AM
> To: Lua list
> Subject: One time scripts
> Using lua 4.01 and only one Lua_State, does anyone know how to make a
> script be a one time only?  I have some config files I use lua for and
> can
> set any of the tables in the script to nil but I still have the code
> around.
> I need a way to kick everything out that the file had.
> Leigh McRae
> Lead Programmer
> Rockstar Games Toronto