lua-users home
lua-l archive

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


On Mon, 09 Mar 2015 15:07:26 -0400
Tom N Harris <telliamed@whoopdedo.org> wrote:

> On Monday, March 09, 2015 01:47:24 PM Pouar wrote:
> > Can you please include the option to disable printing the return
> > value in interactive mode. It's annoying.
> > 
> > I'm not suggesting removing it altogether, just the option to
> > disable it.
> 
> You're referring to the patch[1] I wrote a few months ago? That's
> only about adding the keyword 'return' to expressions typed in the
> prompt. Are you saying you want to not see the return value from
> expressions? I don't understand why you'd want that.

I think something else is meant: If you type an expression, press
enter, view the result, and then press the <UP> key to browse through
the history (using readline), the statement will show up with a
preceeding "return ".

Consider the following example:

# Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
# > math.random()
# 0.84018771676347
# > 

Now you press the <UP> key, and the following text will show up on the
last line:

# > return math.random()

I also find this "return" slightly annoying. It would be nicer if just
the following line would be shown:

# > math.random()

> 
> Not wanting the return from statements is understandable. But whether
> by accident or design you can already do it. Add two semicolons after
> the statement.
> 
>     > math.random()
>     0.84018771676347
>     > math.random();;
>     >
> 
> It also works to type the semicolon before the statement. But neither
> of these will allow you to type an expression.
> 
> 
> [1] http://lua-users.org/lists/lua-l/2014-12/msg00336.html
> 
> -- 
> tom <telliamed@whoopdedo.org>


Kind Regards,
Jan