Lua wrap number

This article is tagged with: Lua wrap number and lua

lua wrap number

local function wrap(x_max, x_min, x)
return (((x - x_min) % (x_max - x_min)) + (x_max - x_min)) % (x_max - x_min) + x_min;
end

This article is tagged with: Lua wrap number and lua