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 »

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 »

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 »

awww... didnt work :(
User avatar
Administrator
Site Admin
Posts: 5342
Joined: Sat Jan 05, 2008 4:21 pm

Re: removing numbers after decimal.

#4 Post by Administrator »

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 »

thanx admin, that worked great ^^
Post Reply