What Dreamora was aiming for was:
Make sure you feed the function a double (put a ! on the end of the values you send it, or make sure you use a variable of type double).
There's a better way of doing this, I'm sure.
Function round:String(value:Double,digit:Int) ' return type must be string otherwise it will have more than 2 digit ' value = the number you want to be rounded. ' digit = the number of digits to round to. value :* 10!^digit ' so, if value = 0.45 and digit = 2, value will now be 0.45*100 = 45 Local valuei:Int = Int(value) ' Converts 'value' to an integer. Local result:String = String(valuei) ' 'result' is now a string containing "45" result = Left(result , result.length - digit) + "." + Right(result , digit) ' this just formats the string to display the correct decimal value. Return result End Function Print round(.45!,2)
Make sure you feed the function a double (put a ! on the end of the values you send it, or make sure you use a variable of type double).
There's a better way of doing this, I'm sure.