Lua Scripts

Everyone,

I am trying to use two lua scripts and have the entry in the
orthanc.json configuration file as :

"LuaScripts" : [
"/etc/orthanc/lua/script_one.lua",
"/etc/orthanc/lua/script_two.lua"
],

I have tested script_one.lua by itself and it worked without a problem.

When I added script_two.lua as per above, script_one.lua apparently
failed to activate, but script_two.lua worked fine.

In trying to figure out what happened I noticed that the verbiage in
the config file above the lua scripts states that only the paths should
be in the bracket's and not the file name. Is this correct?

// List of paths to the custom Lua scripts that are to be loaded
// into this instance of Orthanc

Does this in fact mean that once the path is set in the orthanc.json
config file orthanc will execute all the scripts in the appropriate
directory?

Thanks,

Greg Ennis

Your syntax looks correct.
Are you sure you don’t define twice the same calback in both files ? I.e, If you define OnStableStudy in both lua files, I’m almost sure that only one will be called.

Alain,

Thank you for your help!!!

I am using 'OnStoredInstance(instanceId, tags, metadata)' in each lua
script. Does this function have the same requirement to be used only
once.

Hello, yes, “OnStoredInstance()” must only be defined once.

Sébastien-

Sébastien,

Thanks much, I merged both scripts into one script, and was able to make things happen appropriately,

Greg