[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] LuaCocoa v.0.2 released
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 9 Mar 2011 08:32:58 +0200
On Tue, Mar 8, 2011 at 10:17 PM, Eric Wing <firstname.lastname@example.org> wrote:
> I haven't reviewed the string.format() implementation, but it seems to
> be reasonable to expect __tostring to be invoked on userdata when the
> %s token is found. Certainly as a user, I expect this.
It's the same with table.concat, and the argument is that these are
low-level fast primitives that throw errors rather than trying to make
a coercion that might not make sense (e.g. a function or a plain table
should not be rendered as a string).
>> 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 ?