PDA

View Full Version : Threads


bule
08-02-2006, 02:52 AM
Is there a way to create, program, and run a seperate threads using LUA in APMS?

Brett
08-02-2006, 09:35 AM
Although Lua does not have true multithreading, it does support "coroutines":

http://www.lua.org/manual/5.0/manual.html#2.10

bule
08-02-2006, 10:08 AM
I've read about them, however, I'm searching for something similar to On Timer event...
So that part of my code can run concurrently with the chunk of code which calls it.

Brett
08-02-2006, 11:12 AM
You could make the coroutine yield and resume on the timer... never tried it but a possibility.

bule
08-03-2006, 03:44 AM
You could make the coroutine yield and resume on the timer... never tried it but a possibility.

I thought about that actually... will try it once!

TJ_Tigger
08-03-2006, 08:25 AM
Here is a link to a tutorial for coroutines from the lua-users page

http://lua-users.org/wiki/CoroutinesTutorial

Tigg