lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Fri, Jul 20, 2018 at 6:50 AM, Bill Kelsoe <wildbillkelsoe@gmail.com> wrote:
Hi, I recently built a sample code for calculating reciprocal winds for flight simulation purposes. I want to limit user input to numbers from 0-359 inclusive. Nothing like 360 should be entered by user. How can I do this?


You can certainly do this, but do you need to?

-30 and 720 both have unambiguous interpretations as degrees.

Even if you don't want to support negative degrees (admittedly a bit more complex), a simple n % 360 would give 
accurate results,  which shouldn't be surprising to your users.