Garry's Mod Wiki

Garry's Mod Wiki

  number math.Truncate( number num, number digits = 0 )


Trim unwanted decimal places.


1 number num
The number to truncate
2 number digits = 0
The amount of digits to keep after the point.


1 number
The result.


Demonstrates the use of this function.

local num = 54.59874 print( math.Truncate( num, 2 ) ) -- 54.59 print( math.Round( num, 2 ) ) -- 54.6
54.59 54.6

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...