Hi - New to Lua… Does anyone know if it’s possible to install and use Lua libraries (say via LuaRocks) within the Orthanc Lua scripting engine? Tried installing as part of my Dockerfile, but getting an error “Lua interpreter not found in $PATH”.
Hello,
Check out this thread:
https://groups.google.com/d/msg/orthanc-users/BXfmwU786B0/4eF2iKI3BAAJ
Sébastien-
Thanks for that! I’m using the orthanc-plugins Docker image, v1.4.2. Getting an error trying to load an external Lua lib:
E1023 13:38:07.650811 LuaContext.cpp:590] Error while executing Lua script: error loading module ‘lfs’ from file ‘/usr/local/lib/lua/5.2/lfs.so’:
dynamic libraries not enabled; check your Lua installation
If I require it from the lua console and use the lib, it works fine.
Any ideas what I’m doing wrong?
have you tried pulling the 1.4.2 image again since it has been updated ?
docker pull jodogne/orthanc-plugins:1.4.2
Pruned all my docker images, re-pulled, and re-built. Same error.
It does work. Here is a full sample session:
$ sudo docker pull jodogne/orthanc
$ sudo docker run -i -t --rm --entrypoint=bash jodogne/orthanc
root@da959f58e39f:~# apt-get update
root@da959f58e39f:~# apt-get install liblua5.1-socket
root@da959f58e39f:~# cat << EOF > Sample.json
{
“LuaScripts” : [ “Sample.lua” ]
}
EOF
root@da959f58e39f:~# cat << EOF > Sample.lua
socket = require (“socket”)
EOF
root@da959f58e39f:~# LUA_PATH=/usr/share/lua/5.1/?.lua LUA_CPATH=/usr/lib/x86_64-linux-gnu/lua/5.1/?.so Orthanc Sample.json
Regards,
Sébastien-
NB: The instructions above are valid for jodogne/orthanc:1.4.2, but not for jodogne/orthanc:1.5.0, because Lua has been upgraded from version 5.1.5 to version 5.3.5 in Orthanc 1.5.0, and because Lua modules are only binary compatible if their major.minor version are the same.