View Issue Details

IDProjectCategoryView StatusLast Update
0000035opensim-SCBugpublic2019-07-23 15:15
Reporteronefang Assigned Toonefang  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product Version0.9.0.1 RC0 
Target Version0.9.0.1 RC0 
Summary0000035: Casting.
DescriptionThere are various inconsistencies between SL and various OS version about how casting works. It doesn't help that SL doesn't define these well.
Additional Informationhttp://wiki.secondlife.com/wiki/Typecast

Only mentions implicit casts string -> key and Integer -> float
Doesn't mention double casts, which happens in SL sometimes, but is an error in OS.
Doesn't mention implicit integer -> string, though uses that in examples elsewhere.

http://wiki.secondlife.com/wiki/LSL_101/LSL_in_Focus:_Integers

Includes a "Integers to other types" section, which is blank.
Tagsscript engine

Relationships

parent of 0000019 resolvedonefang Int and string list items no longer compare correctly. 
parent of 0000036 closedonefang Double casts. 

Activities

onefang

onefang

2019-06-13 16:01

administrator   ~0000030

Last edited: 2019-07-23 14:20

Includes an example of using a list to avoid explicit casting, notable coz it is using integers and strings.


integer min; integer max; integer total;
llSay(0, (string) ["Minimum: ", min, "  Maximum: ", max, "  Total: ", total] );  // requires 1 explicit cast instead of 3

onefang

onefang

2019-06-13 16:10

administrator   ~0000031

Last edited: 2019-07-23 14:23

LSL_Operators includes the text about not being sure if boolean operator precedence is a bug or a feature. SL's own description of LSL isn't a proper specification of the language. Pffft

"Note: The order of precedence of boolean operators is unclear. It is possible that there is a bug in the expression parser, making precedence inconsistent, or it may simply be that || and && have equal precedence; testing is inconclusive. Thus, when in doubt, parenthesize. SubNote: As the above bug has been closed as expected behavior, one can only assume the boolean operators have equal precedence."

onefang

onefang

2019-06-13 16:12

administrator   ~0000032

I was sure I had seen an example in SL's LSL portal of implicit casting integer to string, can't find it now. It has always worked for me anyway.
onefang

onefang

2019-06-17 04:10

administrator   ~0000035

This form works fine in OpenSim 0.8 and 0.9, but not in current SL -

"string " + 1
In current SL it has to be -

"string " + (string)1
onefang

onefang

2019-06-17 06:14

administrator   ~0000037

Note - Lua will implicitly cast "numbers" to strings and strings to "numbers" when they are mixed.
onefang

onefang

2019-06-18 01:54

administrator   ~0000040

Going forward we'll want to use the Lua friendly way.
onefang

onefang

2019-07-23 15:15

administrator   ~0000098

The two child bugs are resolved, and the main issue with this one already works correctly in both versions of OpenSim. SO lets close this one to.

Issue History

Date Modified Username Field Change
2019-06-08 07:39 onefang New Issue
2019-06-08 07:39 onefang Status new => assigned
2019-06-08 07:39 onefang Assigned To => onefang
2019-06-08 07:39 onefang Tag Attached: script engine
2019-06-08 07:39 onefang Relationship added parent of 0000019
2019-06-12 23:26 onefang Relationship added parent of 0000036
2019-06-13 16:01 onefang Note Added: 0000030
2019-06-13 16:10 onefang Note Added: 0000031
2019-06-13 16:12 onefang Note Added: 0000032
2019-06-17 04:10 onefang Note Added: 0000035
2019-06-17 06:14 onefang Note Added: 0000037
2019-06-18 01:54 onefang Status assigned => confirmed
2019-06-18 01:54 onefang Note Added: 0000040
2019-06-18 02:06 onefang Status confirmed => acknowledged
2019-07-23 14:20 onefang Note Edited: 0000030
2019-07-23 14:22 onefang Note Edited: 0000031
2019-07-23 14:23 onefang Note Edited: 0000031
2019-07-23 14:23 onefang Note Edited: 0000031
2019-07-23 15:15 onefang Status acknowledged => closed
2019-07-23 15:15 onefang Resolution open => no change required
2019-07-23 15:15 onefang Note Added: 0000098