PDA

View Full Version : Is there formatted string (i.e., printf) capability?


Ken Gartner
03-16-2005, 09:37 AM
I need to produce columnar String data, where each column is supposed to be a certain number of characters in width (padded with spaces as needed). This is something that printf() excels at, but I do not find any formatting capability in True Update 2.0. I suppose I could write my own using String.Length, String.Repeat, String.Concat, etc., but perhaps TU already supports this operation in some form. How can I create formatted Strings in True Update 2.0?

Thanks for any ideas. Regards,

Ken Gartner

Brett
03-16-2005, 10:18 AM
The underlying Lua language has string.format (note the lower-case syntax). It works identically to printf. Look here:

http://www.lua.org/manual/5.0/manual.html#5.3