   digits
  I''m using Lua 5.0 and I want to make sure that all the numbers I output have 5 digits total(position of the decimal point doesn''t matter), using only a lua script. 
  According to the Lua documentation (hint hint), use tostring or string.format. ;quote:Original post by Oluseyi  According to the Lua documentation (hint hint), Read it and loved it.quote:use tostring or string.format.   Format supposedly accepts printf modifiers, which include *minimum-width* specifiers and how many digits may be included before and after the decimal, but not the total.Tostring?  Come on, who here makes a post because they want a complex answer?  I don''t see another way so I''ll start writing, it''s just that this function will be called many thousands of times(not real-time though but I want it done this century-3d model file converter).Additional information, I''m doing this because the program that reads this in will be expecting the numbers as I''ve described, I don''t know what happens when they''re out of whack, I don''t have access to the program source, and I plan on releasing this to as large an audience as possible so it seems silly to require a change to the lua vm(hence it must be done with a script and no ''binded'' C functions either).Thanks for posting. ;  Doesn''t make sense. Processing such arbitrarily-formatted input is (unnecessarily) hard; what program is this, and are you sure you got the specs nailed down?Assuming you have, determine the number of pre-decimal digits (whole part of log10(value)), then determine how many post-decimal digits you can have. 