[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Script Reloading
- From: Tim Gogolin <tgogolin@...>
- Date: Fri, 06 Aug 2004 09:43:30 -0500
On Aug 6, 2004, at 9:11 AM, John Paquin wrote:
Have any of you guys dealt with the problem of using a class
inheritence structure and trying to reload scripts on the fly?
We'd like to be a able to run our app (which would load some script
files), then be able to change the script files and reload them and
have the existing objects reflect the changed source.
The problem, of course, is that we're using a class structure, and our
method tables point directly to the methods of the classes we've
inherited from. When we reload the script, our references don't
change, there's simply a new version of the methods in the lua state
somewhere.
One way to handle this would be to keep a list of the names of the
inherited classes for each class. Then when a method gets called, we'd
go through the list and get the inherited class definition from the
global table and try to find the method. If it didn't exist, we move
on to the next name.
youch. It hurts just talking about doing it this way, but I'm
thinking that in reality, our class structure won't be very deep, so
lookups would be limited to 2 or 3 at most.
Anyone else have any other brainy ideas?
Keep a weak keyed list of all Class instances and refresh their method
tables after reloading a script?
-- Tim Gogolin