map

v0.1.7
map(value, start, end, target_start, target_end);

Maps x from an original range to a target range.

Arguments

valueThe value to map
startThe start of the initial range
endThe end of the initial range
target_startThe start of the target range
target_endThe end of the target range

Returns

numberThe mapped value

local mouseX_mapped = map(mouseX, 0, width, 0, 100);
-- mapped mouseX between 0 and 100
See map in lu5_math.h