Can someone explain what this means?
[lua]local a_health = math.floor(wings.health,0)[/lua] [import]uid: 51459 topic_id: 16770 reply_id: 316770[/import]
Can someone explain what this means?
[lua]local a_health = math.floor(wings.health,0)[/lua] [import]uid: 51459 topic_id: 16770 reply_id: 316770[/import]
Well first, math.floor only takes one parameter according to the API, so the “,0” shouldn’t be doing anything.
The function math.floor function takes a floating point number and rounds it down to the lowest integer. So math.floor(123.456) returns 123.
[import]uid: 19626 topic_id: 16770 reply_id: 62782[/import]
I’m going to go ahead and guess you are referring to the second argument. After testing, this does nothing.
If you were wanting more information on math.floor in general, please see the following link: http://developer.anscamobile.com/reference/index/mathfloor [import]uid: 9484 topic_id: 16770 reply_id: 62781[/import]
Hi lluahs I know how to search math.floor and find what little info is on the API… I just was wondering why 0?
And Rob would math.floor(-123.456) return -123?
So thematically I can do this math.floor(-0) return -0 if the above statement is true? [import]uid: 51459 topic_id: 16770 reply_id: 62786[/import]
-124 I think [import]uid: 19626 topic_id: 16770 reply_id: 62787[/import]
ok thanks for the help Rob.
[import]uid: 51459 topic_id: 16770 reply_id: 62788[/import]
math.floor(-0) should return 0. Its the next lowest integer. -0 doesn’t really exist on our modern computers, so it would become 0, and 0 truncates down to 0.
But it would be easy enough to write a quick test program and see the behavior yourself. [import]uid: 19626 topic_id: 16770 reply_id: 62846[/import]