LlAbs

From OpenSimulator

Jump to: navigation, search

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