[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: yielding troubles
- From: "Bilyk, Alex" <ABilyk@...>
- Date: Thu, 4 Dec 2003 15:17:24 -0800
It is not quite clear from your example what Lua threads are involved and the relationship between them. You cannot yield from any Lua threads back to C (for instance the main thread cannot yield). You can only yield from one Lua thread to another Lua thread.
AB
-----Original Message-----
From: Matthew Harmon [mailto:matt@matthewharmon.com]
Sent: Thursday, December 04, 2003 12:16 PM
To: Lua
Subject: yielding troubles
Well... I'm a Lua addict. Our game engine is more and more becoming just a
set of functions that are called from Lua!
Anyway, I want to have one Lua program call another and execute in the same
thread. For all practical purposes this is essentially like #include-ing
code from another file. In the child script, I'd like to be able to issue a
yield, but it doesn't seem to be working. This should give the idea in
pseudo code:
-- MainScript.lua
RunScriptInCurrentThread("LoadKeyConfiguration.lua");
RunScriptInCurrentThread("DoStartupStuff.lua");
RunScriptInCurrentThread("OpeningSlideshow.lua");
PrintMessage("Well, that slideshow lasted roughly 4 seconds!");
-- OpeningSlideshow.lua
ShowSlide("xxx")
"yield" for 2 seconds
ShowSlide("xxx")
"yield" for 2 more seconds
Is this because the yield is essentially nested two-deep in C calls? Any
help, thoughts, suggestions would be most appreciated.