lua-users home
lua-l archive

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


I have a console, and I want people to be able to enter lua expressions
in, and see the results without having to do anything "special".

Should I just take their input, and put a "return( " before it and a ")"
after it? This seems a little hackish... is it the best way? What I
really want is the expression to not have its return stack discarded.

% lua -i
> function two() return 2 end
> two()
> return two()
2
> return( two() )
2
> return( two() + 4 )
6
> return( {"a", "b"} )
table: 0x8068b40
>

I'll have to implement __tostring for tables, I guess.

Sam