开发者

Yielding a thread from another thread (lua)

I am trying to create a sleep function for Lua, since m开发者_如何学编程y Lua-Scripts all run in a different thread/environment I wanted to yield their thread and restart from the main thread when the given amount of time elapsed, the main thread is in Java and the time elapsing is done with a loop.

Now this isn't really hard or something but I am trying to use Lua's own coroutines/threads so I don't have to create my own thread structure but (my Lua knowledge isn't top-notch) I don't know how I can yield a thread from outside of the thread.

Is it possible to yield a thread from the main thread?

Edit Nevermind, I just figured it out. I did a getfenv and used the coroutine.yield of the script it's own environment.


I used the script it's coroutine.yield function. Pretty easy looking back at it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜