Menu

#107 "(v=expr);" unusable in OpenSim

open
None
5
2015-07-13
2010-02-13
AlexRa
No

The optimizer turns assignments "x = expr;" into "(x = expr);". This syntax might be valid for SL, but OpenSim does NOT allow it, displaying the following error:

"Error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement"

In other words, EACH assignment in the generated LSL script produces an error, making the output of LSL+ unusable for OpenSim.

You might argue that it's OpenSim's fault, but wrapping everything into parenthesis does look weird and in many cases makes
the generated script unreadable.

This is especially bad for long string concatenations such as

llSay("This is " + a + " sample " + (string)obj + ...);

The "optimizer would turn it into:

llSay(((("This is " + a) + " sample ") + (string)obj) + ...);

I do realize why that happens (the optimizer re-builds expressions back from trees), but surely it can be tweaked to skip the unneeded "()" ?

Discussion

  • Cheshyr Pontchartrain

    Agreed. i was fighting this particular "feature" earlier today, while trying to do tests on in-world scripts. What optimizer is causing this particular mess? Eclipse itself, or LSL Plus?

     
  • Maike Short

    Maike Short - 2011-03-27

    A workaround is this unix command:

    sed "s/^\( *\)(\(.*\));/\\1\\2;/" < lsl.lsl > lsl.lslos

    related: http://opensimulator.org/mantis/view.php?id=5422

     
  • Kevin Buckley

    Kevin Buckley - 2012-05-19

    Has anyone confirmed that SED filter string? I tried it using a version of sed for windows and it adds spurious '\1\2;' throughout the text.

     
  • Eric Livingston

    Eric Livingston - 2015-07-13

    This issue is also taken up here, and there's an offered patch that seems to correct the issue:

    https://code.google.com/p/lslforge/issues/detail?id=3

    I hope the SED thing works in the meantime, as I'm also trying to do a bit with OpenSim and LSLPlus is just a great plugin and tool - I've come to depend on its preprocessing as I do a lot of bitwise manipulations, and it's pre-processed resolution of all that really speeds up my routines!

     

Log in to post a comment.

MongoDB Logo MongoDB