diff --git a/stepmania/Themes/default/Scripts/Utilities.lua b/stepmania/Themes/default/Scripts/Utilities.lua index 1c0cf2c5e3..6ea84e8a4d 100644 --- a/stepmania/Themes/default/Scripts/Utilities.lua +++ b/stepmania/Themes/default/Scripts/Utilities.lua @@ -30,16 +30,6 @@ function TableMetricLookup( t, group ) return ret end --- Scales x so that l1 corresponds to l2 and h1 corresponds to h2. -function scale( x, l1, h1, l2, h2 ) - return (((x) - (l1)) * ((h2) - (l2)) / ((h1) - (l1)) + (l2)) -end - --- Scales x so that l1 corresponds to l2 and h1 corresponds to h2. -function scale( x, l1, h1, l2, h2 ) - return (((x) - (l1)) * ((h2) - (l2)) / ((h1) - (l1)) + (l2)) -end - function split( delimiter, text ) local list = {} local pos = 1 @@ -64,10 +54,6 @@ function join( delimiter, list ) return ret end -function clamp(val,low,high) - return math.max( low, math.min(val,high) ) -end - function wrap(val,n) local x = val Trace( "wrap "..x.." "..n ) diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index ff81ace676..b8cc1ad142 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -469,6 +469,14 @@ LuaFunction( Trace, Trace(SArg(1)) ); #include "ProductInfo.h" LuaFunction( ProductVersion, (CString) PRODUCT_VER ); +static float scale( float x, float l1, float h1, float l2, float h2 ) +{ + return SCALE( x, l1, h1, l2, h2 ); +} +LuaFunction( scale, scale(FArg(1), FArg(2), FArg(3), FArg(4), FArg(5)) ); + +LuaFunction( clamp, clamp(FArg(1), FArg(2), FArg(3)) ); + /* * (c) 2004 Glenn Maynard * All rights reserved.