lua-users home
lua-l archive

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


Perfect,

> -----Original Message-----
> From: Ignacio Castaño [mailto:castanyo@yahoo.es]
> 
> Sorry Chris, that's what you would do on the C side:
> 
> First, create your main lua state with lua_open.
> 
> Create a new thread for each scripts that you want to run in 
> parallel, that
> is a state with its own stack.
> 
> Instead of lua_dofile, use lua_load or any of the functions 
> that provides
> the aux library (ie. luaL_loadbuffer). That parses your 
> script and leaves
> the main function on the top of the stack.
> 
> Instead of using lua_pcall to run that function, use 
> lua_resume, that way,
> it will yield when it finds a yield function. You can resume 
> the thread as
> many times as you want, but you will have to use some kind of 
> return codes
> to determine the end of the execution (or use lua_getstack).
> 

Perfect answer, that in combination with Peter Shook's completed example filled the holes in my understanding. 

Many thanks to everyone, I've got it now...


NOTICE
This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.