Skip to content

Instantly share code, notes, and snippets.

@madebyjeffrey
Created August 1, 2011 00:09
Show Gist options
  • Save madebyjeffrey/1117370 to your computer and use it in GitHub Desktop.
Save madebyjeffrey/1117370 to your computer and use it in GitHub Desktop.
math.clamp
function math.clamp(v, min, max)
if v > max then
return max
elseif v < min then
return min
else
return v
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment