Lua: converting from float to int

后端 未结 4 1836
耶瑟儿~
耶瑟儿~ 2021-02-02 06:51

Even though Lua does not differentiate between floating point numbers and integers, there are some cases when you want to use integers. What is the best way to covert a number t

4条回答
  •  时光说笑
    2021-02-02 07:43

    why not just use math.floor()? it would make the indices valid so long as the numerator and denominator are non-negative and in valid ranges.

提交回复
热议问题