|
Post by chanterelle on Jan 22, 2006 18:40:49 GMT -5
If a coroutine is running and the script is unloaded, the game locks up. What is the workaround for this?
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 22, 2006 19:17:55 GMT -5
I've messed around with the coroutine area of Lua a bit and with good programming, anyone can duplicate it without the limitations it has.
If you use coroutines, you can use any metamethods and you can't use any of the addons Tiny wrote for Lunar. Doing so causes an internal Lua error.
As for the workaround, I do what I always do. Write the code I need to run every so often into a function and run a call to that function everytime I need to.
|
|
|
Post by chanterelle on Jan 22, 2006 19:21:30 GMT -5
The metamethods and addons issue was expected, and not a problem. The problem is that if you kill the script, the coroutine is dangling or something.
|
|
|
Post by TinyTerror on Jan 22, 2006 20:24:49 GMT -5
I don't know what to tell you. You guys are way ahead of me actually writing scripts.
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 23, 2006 12:58:39 GMT -5
The metamethods and addons issue was expected, and not a problem. The problem is that if you kill the script, the coroutine is dangling or something. True, just saying that I don't use coroutines anymore because of those expected issues. I don't know what to tell you. You guys are way ahead of me actually writing scripts. The coroutine.create() function returns a varible type 'thread' although coroutines don't completely act like threads in the way that you have to keep bouncing focus between the function you tell coroutine.create() to run and the main script itself.
|
|