lua-users home
lua-l archive

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


On Dec 10, 2001 at 12:03 -0800, Bret Mogilefsky wrote:
> 
> Further steps to enhance your use of this patch immediately suggest
> themselves, and all are done with no modification to Lua itself:
> 
> Register functions for traversing the list of lua_States (similar to
> next()).  Then you can replace or wrap the functions in the reflexive debug
> interface (section 7.4 of the manual) such that they take an extra
> parameter to indicate the lua_State you're asking about, just as the C
> versions of these functions have.  Now you have the minimal interface
> necessary to write a debugger in Lua that's capable of enumerating and
> describing all of the other lua_States as well as its own!
> 
> Register a function called fork() that takes a function and its parameters
> and adds a new lua_State ready to run it to the end of the list.
> 
> Register a function called kill() that terminates a given lua_State.
> 
> Register a function called join() that waits for a given lua_State to
> terminate and inspects its return values.
> 
> Register a function called nice() that takes a given lua_State and moves it
> around in the list, or adds it into the list multiple times.  Now you can set
> both how often and in what order a lua_State gets resumed relative to its
> peers.
> 
> Hopefully more possibilities spring to mind when you see these.  If someone
> does all of these as a library and posts it, game developers all over will
> rejoice...

Yeah, those sound like great ideas.  You could use those to build up a
complete Actor framework in Lua, like Steve D mentioned.

The two other big tasks I see right now are 1) porting the patch to
4.1 in order to use Lua threads, and 2) having a way to serialize the
entire Lua computation state (including heap).  I've got a bunch of
other (non Lua-related) things in the pipeline at the moment, so
anybody wanting to take a crack at those, don't be shy!

-- 
Thatcher Ulrich <tu@tulrich.com>
http://tulrich.com