Math.map
From GiderosMobile
Available since: Gideros 2026.1
Class: math
Description
Returns a value that represents x mapped linearly from the input range (inmin to inmax) to the output range (outmin to outmax).
(number) = math.map(x,inmin,inmax,outmin,outmax)
Parameters
x: (number) the value to map
inmin: (number) input range minimum value
inmax: (number) input range maximum value
outmin: (number) output range minimum value
outmax: (number) output range maximum value
Return values
Returns (number) the new linearly mapped value
Example
local val = math.map(0, 0, 100, -1, 1)
print(val) -- -1
- Math
- Math.abs
- Math.acos
- Math.asin
- Math.atan
- Math.atan2
- Math.ceil
- Math.clamp
- Math.cos
- Math.cosh
- Math.cross
- Math.deg
- Math.distance
- Math.distances
- Math.dot
- Math.edge
- Math.exp
- Math.fft
- Math.floor
- Math.fmod
- Math.frexp
- Math.ifft
- Math.inside
- Math.ldexp
- Math.length
- Math.lerp
- Math.log
- Math.log10
- Math.map
- Math.max
- Math.min
- Math.modf
- Math.nearest
- Math.noise
- Math.normalize
- Math.pow
- Math.rad
- Math.random
- Math.randomseed
- Math.raycast
- Math.round
- Math.sign
- Math.sin
- Math.sinh
- Math.sqrt
- Math.tan
- Math.tanh