[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: Lua intepreter does not print results for multiline input
From:       Dirk Laurie <dirk.laurie () gmail ! com>
Date:       2014-10-26 12:51:39
Message-ID: CABcj=tko=YWB+r6B6_rzvJxocCRJrihes+P=Am31saNyHLgtYQ () mail ! gmail ! com
[Download RAW message or body]

2014-10-26 13:19 GMT+02:00  睿 <zrui16@hotmail.com>:
> In lua 5.3 intepreter:
>
>> table.unpack{1,2,3}
> 1       2       3
>> table.unpack{
>>> 1,2,3
>>> }
>>
>
> The intepreter does not print results for the second input, which has multiple lines.

Correct. This is what the documentation says it should do.

| After reading a line, Lua first try to interpret the line as an expression.
| If it succeeds, it prints its value. Otherwise, it interprets the line as
| a statement. If you write an incomplete statement, the interpreter
| waits for its completion by issuing a different prompt.

> However, adding the prefix '=' works fine.

Because '=' is replace by 'return'.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic