Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Lua and Integers!
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Gore
(207 posts) Bio
|
| Date
| Tue 13 Feb 2007 07:31 PM (UTC) |
| Message
| Once again, an extremely apparent novice Lua question:
I can't seem to find how to convert a floating point number to an integer.
if x = 7.34934 I want to convert x to 7
Also if x = 7.9348, I still want to convert it to 7.
Any ideas on how I can do this, did I miss the function somewhere? | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #1 on Tue 13 Feb 2007 10:48 PM (UTC) |
| Message
| Use the function math.floor. (math.floor rounds down, and math.ceiling rounds up.) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Gore
(207 posts) Bio
|
| Date
| Reply #2 on Wed 14 Feb 2007 09:26 AM (UTC) |
| Message
| | Ahhh thanks a bunch! Sorry I overlooked that :/ | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,385 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top