lua-users home
lua-l archive

Latent functions

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


How do I make latent functions in Lua?
When I am inside a c-function (called by Lua) I want to "pause" execution
and resume that at a later time. The function that called lua in the first
place should return (lua_dostring, lua_dofile etc)
Pseudo-code:
--------------------------------------
int threadId;
static int aLatentFunction( lua_State *L )
{
 threadId = lua_pause( L );
 return 0;
}
main()
{
 lua_dostring( L, "aLatentFunction() \n anotherFunc()" );
 
 // dostring returned, even though anotherFunc isn't called yet.
 
 lua_resume( L, threadId ); // anotherFunc will be called
}
---------------------------------------

AltStyle によって変換されたページ (->オリジナル) /