math.round

From Wake
Jump to: navigation, search

Get the value of the nearest integer. The fraction 0.5 will round in a direction chosen by the implementation. Do not expect that the result of math.round(0.5) will be the same across all platforms!

Function

Synopsis

result = math.round(x)

Arguments

number,Vector2,Vector3,Vector4 x

The value.

Returns

number,Vector2,Vector3,Vector4 result

The nearest integer to x.

Notes

  • This function implies the argument type based on the first argument. As such, you may not use table shorthand for the first argument if it is supposed to be a vector.
  • While it seems like this function might overwrite the equivalent function in the Lua standard library, it does not. Lua doesn't actually provide a math.round function.

See Also