lua-users home
lua-l archive

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


Quite some time ago, there was a discussion about whether
('%s'):format and table.concat should call tostring if something it
must act on is not a string.  Roberto [1] thought yes for the former,
no for the latter.

The Lua 5.2 beta documentation does not say so, but the behaviour of
`('%s'):format` in Lua 5.2 beta has indeed been modified accordingly.
Maybe it is worth half a sentence in the manual:

- The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a
number as argument, whereas q and s expect a string.
+ The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a
number as argument, whereas q expects a string and s coerces its
argument to a string by calling tostring.

[1] http://lua-users.org/lists/lua-l/2010-12/msg00241.html