math.floor

From GMod Wiki

Jump to: navigation, search
Function
Syntax math.floor( Float value )
Where is this used?
Description:
Returns value rounded down to the nearest whole number.
Returns: Integer
Part of Library: Math
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Math.floor]Math.floor [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionFloors down the value.
Used onNewerShared.png
Code
print(math.floor(0.5))
Output0


Another Example

DescriptionChecks a number for a decimal part.
Used onNewerShared.png
Code
function hasFloatingPoint(value)
  return value > math.floor(value)
end
OutputTrue if the number has a decimal part; false otherwise.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox