LlAbs

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created page with "{{LSL Function |func=llAbs |func_id=6|func_sleep=0.0|func_energy=10.0 |func_footnote |p1_type=integer |p1_name=val |p1_desc=Any integer value |return_type=integer |return_text...")
 
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
{{LSL Function
+
{{lslfunc
 
|func=llAbs
 
|func=llAbs
 
|func_id=6|func_sleep=0.0|func_energy=10.0
 
|func_id=6|func_sleep=0.0|func_energy=10.0
Line 14: Line 14:
 
|caveats=*The llAbs of -2147483648 is -2147483648. This is because the positive integer 2147483648 is outside the range of allowed LSL {{LSLGC|Integer|integer values}}.
 
|caveats=*The llAbs of -2147483648 is -2147483648. This is because the positive integer 2147483648 is outside the range of allowed LSL {{LSLGC|Integer|integer values}}.
 
|examples=
 
|examples=
<lsl>
+
<source lang="lsl">
 
default
 
default
 
{
 
{
Line 24: Line 24:
 
     }
 
     }
 
}
 
}
</lsl>
+
</source>
<lsl>
+
<source lang="lsl">
 
// Here's a more elaborate example.
 
// Here's a more elaborate example.
  
Line 52: Line 52:
 
//  Test Object:    llAbs(-20) --> 20
 
//  Test Object:    llAbs(-20) --> 20
 
//  Test Object:    llAbs(0) --> 0
 
//  Test Object:    llAbs(0) --> 0
</lsl>
+
</source>
 
|helpers
 
|helpers
 
|also_header
 
|also_header

Latest revision as of 10:31, 28 January 2019

Summary

Function: integer llAbs( integer val );

Returns Template:Integer that is the positive version of val.

• integer val Any integer value
Template:LSL Other Languages

Caveats

  • The llAbs of -2147483648 is -2147483648. This is because the positive integer 2147483648 is outside the range of allowed LSL Template:LSLGC.

Examples

default
{
    state_entry()
    {
        // PUBLIC_CHANNEL has the integer value 0
        // returns: "The absolute value of -4 is: 4"
        llSay(PUBLIC_CHANNEL, "The absolute value of -4 is: "+(string)llAbs(-4) );
    }
}
// Here's a more elaborate example.
 
ShowAbsolute(integer inputInteger)
{
    string output = "llAbs(" + (string)inputInteger + ") --> " + (string)llAbs(inputInteger);
 
    llSay(PUBLIC_CHANNEL, output);
}
 
default
{
    state_entry()
    {
        ShowAbsolute(-3);
        ShowAbsolute(5);
        ShowAbsolute(-20);
        ShowAbsolute(0);
    }
}
 
//  Here's the output produced by the more elaborate example:
//
//  Test Object:    llAbs(-3) --> 3
//  Test Object:    llAbs(5) --> 5
//  Test Object:    llAbs(-20) --> 20
//  Test Object:    llAbs(0) --> 0

See Also

Functions

•  llFabs float version of llAbs

Articles

•  Template:Wikipedia
Personal tools
General
About This Wiki