[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 5.2 feature list?
- From: "David Burgess" <dburgess@...>
- Date: Mon, 2 Oct 2006 13:50:56 +1000
Seems %m or %t (tostring) would be a fair incremental improvement at little
BTW. Reminder about Ricis Lake userdata improvement
On 10/2/06, Doug Currie <email@example.com> wrote:
Monday, September 11, 2006, 12:32:09 PM, Roberto Ierusalimschy wrote:
>> i have seen some lua 5.2 feature requests. is there an "official" place
>> where the feature requests are stored/tracked?
> Only the list itself.
Here is a proposal for 5.2...
It was a surprise to me that string.format()'s option "%s" did not
apply tostring() to its arguments as print() does.
This would make formatted output using, e.g., loadable numerics
libraries like decNumber, much more convenient. Of course, it would
work with any userdata or class that implemented __tostring.
So, my request is that Lua 5.2 either
- apply tostring() to non-string "%s" arguments of string.format(), or
- add a string.format option that applies tostring() to its argument,
and then performs the usual "%s" action.
If the second approach is preferred, I am not particular to any
specific character to specify this format option, though I recommend
"%m" (use Metatable's __tostring) or "%y" (stringifY) -- neither of
these is in common usage with printf as far as I know, unlike "%o"
(Object) and "%S" (wide String).