[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Newbie: Cooperative Multitasking
- From: Derek Wong <derekw@...>
- Date: Wed, 3 Nov 1999 18:12:20 -0800 (PST)
Hi everybody,
I'm new to the list and new to lua. 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.
What I'd like is something like this...
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...
is that clear? I'm not even sure that's clear to me, but I think
that's what I want. Any advice/code would be appreciated. I've
downloaded Lua 3.2 Multistate, but I'm not sure if it's meant
to do what I want or how to get it to do what I want.
Derek
ps: for those that want the nitty gritty details, I'm working
on a mud, and I'd like to use lua scripts to respond to
player actions.
ie: A player says Hi to a Monster...
the Monster's script gets called and performs the following...
Monster says 'Hello.'
[pause for a second, during which time other stuff is going on]
Monster says 'You look yummy' and proceeds to attack player.