Re: Suggestion: math.between()
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Suggestion: math.between()
- From: Matthew Wild <mwild1@...>
- Date: 2010年6月22日 00:49:58 +0100
2010年6月21日 Adriano Saballa das Chagas <adrianosbl@hotmail.com>:
> math.between(0, 1) = 0.5
> math.between(0, 5) = 2.5
> math.between(8, 4) = 6
> math.between(3, 6) = 4.5
> math.between(8, 7) = 7.5
> math.between(0, 90) = 45
>
> That is what I want
>
Add this line to the top of your script:
function math.between(x, y) return
(math.max(x,y)-math.min(x,y))/2+math.min(x,y); end
Now you have it.
Matthew