Dear list, The following Lua script behaves differently when executed in Lua vs. LuaTeX. print(os.execute("date")) It seems that the definition of os_execute in loslibext.c was copied over from Lua 5.1 and not adapted to newer versions. $ lua5.1 test.lua 0 $ lua5.2 test.lua true exit 0 $ lua5.3 test.lua true exit 0 $ texlua test.lua 0 $ luajit test.lua 0 $ texluajit test.lua 0 As you can see from the example, this comes with the additional complication that LuaJIT has Lua 5.1 behaviour and should also retain that. Cheers, Henri
Below I include a suggestion on how to do this sort of version agnostic.
Cheers, Henri
Live example on Wandbox:
https://wandbox.org/permlink/jEn9kNnPB0t5rwjP
---
#include
Dear list,
The following Lua script behaves differently when executed in Lua vs. LuaTeX.
print(os.execute("date"))
It seems that the definition of os_execute in loslibext.c was copied over from Lua 5.1 and not adapted to newer versions.
$ lua5.1 test.lua 0 $ lua5.2 test.lua true exit 0 $ lua5.3 test.lua true exit 0 $ texlua test.lua 0 $ luajit test.lua 0 $ texluajit test.lua 0
As you can see from the example, this comes with the additional complication that LuaJIT has Lua 5.1 behaviour and should also retain that.
Cheers, Henri
On 11/21/2019 8:17 AM, Henri Menke wrote:
Dear list,
The following Lua script behaves differently when executed in Lua vs. LuaTeX.
print(os.execute("date"))
It seems that the definition of os_execute in loslibext.c was copied over from Lua 5.1 and not adapted to newer versions.
$ lua5.1 test.lua 0 $ lua5.2 test.lua true exit 0 $ lua5.3 test.lua true exit 0 $ texlua test.lua 0 $ luajit test.lua 0 $ texluajit test.lua 0
As you can see from the example, this comes with the additional complication that LuaJIT has Lua 5.1 behaviour and should also retain that. Indeed, the old interface was kept (also for compatibility reasons as lua is used for scripts in texlive etc).
If one used lua as well as luatex as lua engine for the same script one can write a wrapper if needed (I have been thinking of that on context but again it would also mean adapting older scripts laying around.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Henri Menke