removing numbers after decimal.

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

removing numbers after decimal.

#1 Post by botje » Sat Mar 24, 2012 6:15 am

my maxhp function returns 6666.0000

i just need the 6666, how do you remove that in lua?

thanx in advance ^.^

botje

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: removing numbers after decimal.

#2 Post by MiesterMan » Sat Mar 24, 2012 10:07 pm

I know how to do that in C++ for outputting to a printf, not sure if it works the same with lua.

http://www.lua.org/manual/5.1/

If it is the same than you put a .0 after it like:

Code: Select all

printf("You have %.0f hp.\n",hpFloat);

User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: removing numbers after decimal.

#3 Post by botje » Sun Mar 25, 2012 9:33 am

awww... didnt work :(

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: removing numbers after decimal.

#4 Post by Administrator » Mon Mar 26, 2012 1:32 pm

Try this:

Code: Select all

printf("%d\n", someNumber);
%d will give you a whole number. %f will give you floating-point integers.

User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: removing numbers after decimal.

#5 Post by botje » Tue Mar 27, 2012 5:02 pm

thanx admin, that worked great ^^

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests