lua-users home
lua-l archive

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


On Nov 22, 2007 3:03 PM, Markus Heukelom
<Markus.Heukelom@enterprisedynamics.com> wrote:
> Nice idea, but shouldn't the __tostring metamethod decide how a value be
> printed? print() uses tostring() and tostring() tries __tostring() first.

I'm doing this already; check if a table has a __tostring metamethod first.

> Btw, in our interactive lua prompt, for convience I added '?' at the end of
> a line to do exactly the same as '=' in the standard interpreter. Reason: I
> often decide to print the result of a statement _after_ I typed it.

I tried that out, and it looks and feels good!  A useful option in
those cases where using the compiler to guess whether something is an
expression or a statement is dubious.

steve d.