flr( num )

Returns the integer portion (the "floor") of a number.

The number.

For positive numbers, the flr() function returns the integer portion of a number, such as 5 for 5.8.

More generally, flr() returns the closest integer to the number that is less than the number. For negative numbers, the result is more negative.

Examples Edit

print(flr(5.9))   -- 5

print(flr(-5.2))  -- -6

print(flr(7))     -- 7

print(flr(-7))    -- -7

Pico-8 does not have a corresponding "ceiling" function. Here is an implementation that uses flr():

function ceil(num)
  return flr(num+0x0.ffff)

print(ceil(5.9))   -- 6

print(ceil(-5.2))  -- -5

print(ceil(7))     -- 7

print(ceil(-7))    -- -7

See also Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.