lua-users home
lua-l archive

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



> I've looked around and can't find much information on 
> coroutines besides the light doco in man.
> 
> >From what I can gather:
> 
> In my game:
> 
> ------------
> lua_State* Thread = lua_newthread(m_LuaState);
> int ReturnCode=lua_dobuffer(Thread, File, File.GetSize(), a_Name); 
> //Execution return immediatly
> ------------
> 
> My mission script can sit in a loop: (Excuse bad use of Lua 
> Syntax and obvious errors, I've only been looking at the 
> language for a few hours and the really lame use of Lua for a 
> one sided CTF script)
> 
> ------------
> FlagID = GetFlagID("DefaultFlag.Model");
> CaptureZoneID = GetCaptureZoneID(10,10,10,0,0,0); --Size, 
> Position while Collision(FlagID, CaptureZoneID)==false do
> 	Sleep(100) --Milliseconds
> End
> DisplayScoreBoard()
> ------------
> 
> Do I need to use the lua language constructs in something like this?

I've been writing a Lua tutorial and there is a page on coroutines:
http://lua-users.org/wiki/CoroutinesTutorial

The directory of topics is here:
http://lua-users.org/wiki/TutorialDirectory

And there is more information about the tutorial here:
http://lua-users.org/wiki/LuaTutorial

Development of the tutorial is somewhat sporadic as it is done in my
spare time. It is *not* complete; please bear with me, I do intend to
finish it!

You can make comments here:
http://lua-users.org/wiki/TutorialComments

Regards,
Nick