lua-users home
lua-l archive

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


Eike Decker wrote:
I am using a quite similiar approach:

if Agent then Agent.cleanup() end -- Agent must be nil

Agent = {} ...

I need to do some cleanups at the end, since the visual objects in Luxinia are
not directly Garbage collected.

Anyhow, this is not always wanted. For instance, my Agent might have a function
called think, that handles the way it behaves. Now the agent approaches a
certain complex situation that resulted randomly. If I reload, the agent code
is reloaded - and thus the agent is deleted.
I don't see why you would need to do cleanup and delete the agent when you reload the lua file. Reloading the file should just change the function and method definitions and give you new behavior. There should be no need to release resources, etc.

// Niklas