io.stderr what have I missed

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

io.stderr what have I missed

D Burgess-3
# 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?

v
Reply | Threaded
Open this post in threaded view
|

Re: io.stderr what have I missed

v
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 <[hidden email]>