lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Or, is there a way to write a kind of printf (not C's) where the caller 
> would not have to manually tostring every arg which is not a string or a 
> number (provided a tostring func exists for the args in question), before 
> letting it processed by format?

string.format in Lua 5.2 already does that, doesn't it?

function test(x) print(x,string.format("%s",x)) end

test(1)
test(nil)
test("hello")
test(true)
test(print)
test(io.stdin)