Jump to content

Bizzare failure condition


Quistess Alpha
 Share

You are about to reply to a thread that has been inactive for 478 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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 by Quistess Alpha
  • Thanks 1
Link to comment
Share on other sites

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
  • Like 2
Link to comment
Share on other sites

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. . .)

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 478 days.

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
 Share

×
×
  • Create New...