WoW:API floor: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(demoted headings)
m (Move page script moved page API floor to API floor without leaving a redirect)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{:Lua/Libshortcut|floor|math.floor}}
{{wowlua}}


== floor ==
val = math.floor(value)
val = floor(value);


=== Usage ===
== Description ==
val = floor(value);
 
=== Description ===
floor(value) returns the floor of the value (essentially it returns the whole part of the value) i.e. rounds value ''down''
floor(value) returns the floor of the value (essentially it returns the whole part of the value) i.e. rounds value ''down''


=== Example ===
== Example ==
  > local x = floor(10.9);
  > local x = floor(10.9);
  > = x
  > = x
Line 16: Line 14:
  -- Rounding using floor()
  -- Rounding using floor()
  > local x = floor(value + .5)
  > local x = floor(value + .5)
{{LUA}}

Latest revision as of 04:45, 15 August 2023

WoW Lua


val = math.floor(value)
val = floor(value);

Description[edit]

floor(value) returns the floor of the value (essentially it returns the whole part of the value) i.e. rounds value down

Example[edit]

> local x = floor(10.9);
> = x
10
-- Rounding using floor()
> local x = floor(value + .5)