|
Douglas Callahan
Fresh Prince Of SL
Join date: 2 Jul 2004
Posts: 349
|
05-12-2005 15:16
I'm making an effort to expand my flow control beyond if{} and else{}, starting with return. So I read up on wiki and it says that it, "is used for exiting from functions or events". So, where does it exit to? Can I define and say maybe for it to go back to state_entry() or something of the sort? And one more thing, not the point of what I'm trying to do though. return seems to be able to be used also to values. How do you differentiate between these two things for what you want return to do? That's a lot of questions, if you have time respond please 
_____________________
Other than that, Mrs. Lincoln, how was the play?
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
05-12-2005 15:41
The thing about LSL is, it doesn't have to actually be doing anything. When you return from an event, you're really just saying "The script is done handling this event". If there's nothing else to do, it just waits for another event to be triggered. As for returning values, that's pretty strictly for functions. I've never tried, so I don't know what the compiler or interpreter does if you try and return a value from an event. Probably a parse error of some flavor. integer add(integer a, integer b) { return a+b; // add the two values, return the result }
default { touch_start(integer n) { if ( llDetectedKey(0) == llGetOwner() ) { return; // do nothing } else { llWhisper(0, (string)add(1,2)); } } }
|
|
Douglas Callahan
Fresh Prince Of SL
Join date: 2 Jul 2004
Posts: 349
|
05-12-2005 15:46
k, thanks jill 
_____________________
Other than that, Mrs. Lincoln, how was the play?
|