lua-users home
lua-l archive

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


On Jul 07, 2002 at 02:57 +0800, jason zhang wrote:
> 
> 4. Could I execute the lua script step by step? For example, I have
> the following script:
>   man_go_forward( 100, 100, 100 );
>   while( !button_pressed ){ man_wait() };
>   man_talk( "some words" );
>   man_fight();
> I need some control or some delay between lines of script. I need to
> execuate the script to some line, then engine code , then the script from
> the last position .....
>     Is it possible?

This sounds like a job for the new coroutine features in 5.0-work0 --
you can put a "yield()" call in your scripts where you want to return
back to the engine, and the engine can call "lua_resume()" when it
wants to continue running the script from the spot where it yeild()ed.

In the example above, you could replace "man_wait()" with "yield()".

-- 
Thatcher Ulrich
http://tulrich.com