Quistess Alpha Posted January 4 Share Posted January 4 (edited) So, I've never seen LSL do this; when I save a script including this snippet [2 identical jump labels in similar scopes], the viewer doesn't complain, but the server refuses to run the script (close build menu, re-open and edit script and it is set to not running) default { state_entry() { integer a; integer b; if(a) { if(b) { jump break; } @break; }else { if(b) { jump break; } @break; } llOwnerSay("Hello Avatar"); } touch_start(integer total_number) { llSay(0, "Touched."); } } Edited January 4 by Quistess Alpha 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 4 Share Posted January 4 I don't think I have ever tried having more than one jump label in a scope, but the wiki warns against doing that, so it's just as well. I guess that's what you just discovered. Labels are scoped at the event and function level, meaning that it is not possible to declare duplicate labels within the same event or function, even if the labels are enclosed in different if-statements, loops etc. -- SVC-6712 Attempting this will result in an unhelpful CIL assembly related error. -- SCR-256 2 Link to comment Share on other sites More sharing options...
Love Zhaoying Posted January 4 Share Posted January 4 I saw a related jump-label issue recently, code would not even compile with my needed jump labels at certain code positions. (Not duplicates though, sorry.) Someone will certainly condemn us for using jump labels at all! Link to comment Share on other sites More sharing options...
Quistess Alpha Posted January 4 Author Share Posted January 4 4 hours ago, Rolig Loon said: Attempting this will result in an unhelpful CIL assembly related error. -- SCR-256 I'm a little concerned I didn't get any error though, helpful or not. 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 4 Share Posted January 4 Hmm.. Maybe that note in the wiki should be changed to indicate that it fails silently. In any case, re-using the same labels seems a risky choice. It sets up a potential ambiguity that I would prefer to avoid personally. 1 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted January 4 Author Share Posted January 4 11 minutes ago, Rolig Loon said: It sets up a potential ambiguity that I would prefer to avoid personally. Agreed, in my actual use-case I had a copy-pasted block of code in 2 locations in the same function, which I was too tired at that moment to logic around merging. (jump was used as a early exit from a loop; it really would be great if LSL had c-style break and continue, but alas. . .) 1 Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted January 4 Share Posted January 4 10 hours ago, Quistess Alpha said: I'm a little concerned I didn't get any error though, helpful or not. The wiki entry was written almost exactly 11 years ago, so we can expect some difference in behavior. 🙂 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now