lua-users home
lua-l archive

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



On Aug 4, 2005, at 1:03 AM, Jose Marin wrote:

Yes, I was thinking on use coroutines to do this, but
perhaps there is some way of implement a script that
has sequencial tasks, and some taks take a little to
complete.

Another option (depending on your design) is to have the walk(), fire()... command sequence queued up on your C/C++ side (not everything needs to be written in Lua ;-) --- sometimes easier to develop and debug if your app can be driven from C/C++ easily.

Then when the action queue runs dry just call the Lua script to get more actions.  If an action fails (a door closed and the walk command can't finish), then clear the queue and call your script (possibly with a action_failed parameter) to figure out a new action.

Hope that hints at another solution.

Russ