lua-users home
lua-l archive

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


Mark Hamburg skrev:
> [...] I really wish there were a code in string.format for
"take the corresponding argument and run it through tostring". This would
help a lot when generating debugging output where the data may have
arbitrary types.

I agree. One suggestion would be to add another option to string.format that means "debugging format" and the passed data can put in whatever is meaningful for the type in question (optionally with support for a __debug metamethod that returns the string value to use).

I've not come up with this, not sure who has, but it's available in pike (http://pike.ida.liu.se)

Pike btw has more nice format features, take a look at:
http://pike.ida.liu.se/generated/manual/modref/ex/predef_3A_3A/sprintf.html

Regards,
Andreas