lua-users home
lua-l archive

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


Nice idea, but shouldn't the __tostring metamethod decide how a value be
printed? print() uses tostring() and tostring() tries __tostring() first.
So, you could replace tostring with your own version, who tries __tostring
first, and if that fails, 'prettyprints' the value (print the values inside
the table instead of its address). I think that saves you any 'experimental
compilation'.

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. This
saves going back to the beginning of the line. Also, I like its
'appearance':

>1+1?
2
>a = {}
>a?
table: 00033BB08

But that's a matter of taste. Lastly, it don't have codecompletion
implemented, but I can imagine it's usefule there aswell, as '=' can confuse
the codecompletion component, where as '?' at the end doesn't (since the
code is completed before you type the ?).

 
regards, 

_______________________________

Markus Heukelom

Incontrol Enterprise Dynamics
T: +31 (0)346 552500
E: Markus.Heukelom@EnterpriseDynamics.com
W: www.EnterpriseDynamics.com