Garry's Mod Wiki

math.abs

  number math.abs( number x )

Description

Calculates the absolute value of a number (effectively removes any negative sign).

Arguments

1 number x
The number to get the absolute value of.

Returns

1 number
The absolute value.

Example

Demonstrates what this function does.

print( math.abs( 15 ) ) print( math.abs( -15 ) )
Output:
15 15