ID:272154
 
Is it possible to return the result of a procedure before it ends? I recall seeing a setting for procedures and verbs some time ago but I can't find anything of the sort in the reference.

I'm aware that spawn() does this but it won't be feasible without me rewriting lots of code, so I'm really interested in another solution.
I'm pretty sure spawn() is the only way to do this.
By definition when a proc returns it ends, so you really can't do that. See if setting a global variable to the result can help you.
DivineO'peanut wrote:
Is it possible to return the result of a procedure before it ends? I recall seeing a setting for procedures and verbs some time ago but I can't find anything of the sort in the reference.

It is possible, and I believe you're talking about the waitfor setting. Basically, if your function sleeps and the waitfor value is TRUE, then the calling function waits for the called function to return. If it sleeps and waitfor is FALSE, then it returns a value and continues processing alongside the calling function. Here's an example I just made for you:
client/verb/Test()
src << Do_It()

proc/Do_It()
set waitfor = FALSE

. = "hi" // Set the return value
sleep(0) // sleep() initiates a "wait", but Do_It has a FALSE waitfor!

world << "bye"

Hope it helps.

Hiead
In response to Hiead
O_O Wow. Why is stuff like this undocumented?
In response to Hiead
Ah, I knew I saw it somewhere! Thanks.