lua-users home
lua-l archive

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


On Thu, Nov 04, 1999 at 12:26:41AM -0200, Derek Wong wrote:
> I was wondering if someone might
> offer me some advice at implementing cooperative multitasking with
> lua scripts. I'm an amateur programmer so please excuse me if I've
> used the wrong terminology.
[...]
> C program runs along and starts a Lua script...
> Lua script does some stuff and then executes a pause() command
>  expecting the C program to resume at that point when it's ready...
> C program goes along doing other stuff and then at some point
>  along the way will check if there are any Lua scripts waiting
>  to be resumed, if there are it will resume their execution at
>  where they left off...

You'll want to read back through the mailing list archives... Start on the
thread "Game oriented usage of Lua?", which you can find here:

	http://www.egroups.com/group/lua-l/?isDecendingSort=0&searchStart=904&isThreaded=0&fetchForward=0&start=904

At one point in that thread I wrote a LARGE description of how I used Lua in
Grim Fandango when I was at LucasArts, as well as how I modified the
interpreter to support cooperative threading.  I was afraid of getting fired
for divulging details at the time, so I agreed to post on the condition that
it not be included in the archive... However, this is exactly the post you
need!  Oh wait, never mind.  Good thing I already have another job... Here's
the post:

	http://www.egroups.com/group/lua-l/905.html?

I don't have time to read back through the whole thread right this second to
see if I gave details on the gotchas in threading up the interpreter, but I
can give you a thumbnail sketch of how to do it.

Nice to be back on the list...

Bret
-- 
"Why, that's the second biggest monkey head I've ever seen!" --Guybrush
"LeChuck's dead. I blew him into a million gooey pieces."    --Guybrush
Bret Mogilefsky  ** mogul at ay see em dot org **  Programmer, SCEA R&D