lua-users home
lua-l archive

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


On Mar 9, 2011, at 1:32 AM, steve donovan wrote:

>>> Maybe Lua should add a new modifier to string.format() that would call the
>>> __tostring() metamethod in every case.
> 
> Now that makes sense, when the user asks for it - maybe %u ?

[Since %u is used for unsigned integers in printf, I would find it confusing. Note that in the 2006 thread I cited earlier, we discussed other possible modifiers including %m %t and %y (for metatable tostring and stringifY).]

Is there any reason that you would not want string.format to apply tostring to a userdata provided for a %s argument?

e