Formatting in Plua 1.1

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Formatting in Plua 1.1

stephen_monteith
Is there an easy way to format a number to display just two decimal
places?

I've checked the LUA4 manual which says format() takes the same
parameters as printf() but trying format("%.2f", MyNumber) displays
three decimal places.

Thanks

Steve





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply | Threaded
Open this post in threaded view
|

Re: Formatting in Plua 1.1

migueletto
Hi,

> Is there an easy way to format a number to display just two decimal
> places?
>
> I've checked the LUA4 manual which says format() takes the same
> parameters as printf() but trying format("%.2f", MyNumber) displays
> three decimal places.

The decimal place specifier is not implemented in Plua. So "%.2f" is
the same as "%f".

Regards,
Marcio.





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/