lua-users home
lua-l archive

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


On Mon, 2019-10-07 at 14:48 +1100, D Burgess wrote:
> # lua5.2
> Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> > io.stderr:write("Hello World\n")
> Hello World
> # lua5.3
> Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> > io.stderr:write("Hello World\n")
> Hello World
> file (0x7f8a763cc540)
> # lua5.3 -e 'io.stderr:write("Hello World\n")'
> Hello World
> #
> 
> 
> Is this change in behaviour intended?

This is actually change in Lua REPL, not in anything else like file
handling.
Starting from Lua 5.3, any expression evaluated in REPL act as there
was implicit `return` in front of it, while you had to write it or `=`
in front of expression before. For example, try running `tostring(10)`
in Lua 5.2 and 5.3. It will print nothing in first case and `10` in
second.
By the way, this is very useful change. Thanks a lot to Lua devs for
implementing it.
-- 
v <v19930312@gmail.com>