Jump to content


Member Since 20 Jun 2012
Offline Last Active Dec 04 2019 02:59 PM

Posts I've Made

In Topic: Return/break commands not working? [1.12.2]

04 November 2019 - 08:58 PM

View PostLuca_S, on 02 November 2019 - 08:09 PM, said:


As the return needs to be the last statement in a block Lua is going to interpret
As returning the return value of print(stuck), which means print(stuck) is executed again.
Other than that I see no reason why the return shouldn't work, please post your whole code.

Yeah, essentially you're doing return print(stuck) as you might do return 5 or something. The return statement will return from the function though so you must be calling fwd in a loop somewhere.

In Topic: Can't end program using error() function in parallel? What alternative ca...

14 January 2019 - 04:16 PM

I don't know what's going on here. If "Chat exited" is being printed, and "111" isn't, then you know that the `error()` call is ending the coroutine. From the source of parallel.waitForAny (notably line 30), if a coroutine errors, the error should propagate, so the fact that you're seeing "ok" is very weird.

I've tested a modified version of your code on ccemux:

Maybe upload the full code to pastebin? Also, what version of CC are you using, as there may be differences in the parallel API...?

It's also worth noting that error() generally isn't used to end programs, and a conditional loop like what Luca_S suggested is usually better. Doesn't matter too much though. Whatever works.