# HG changeset patch # User Sebastien Jodogne # Date 1367329267 -7200 # Node ID 7035f4a5b07b3146ddcef3f1837e4077159f51ba # Parent 3be5837ceb801ac2fce63f9bfd7ce3c7e8f6f588 installing lua scripts diff -r 3be5837ceb80 -r 7035f4a5b07b OrthancServer/main.cpp --- a/OrthancServer/main.cpp Tue Apr 30 15:36:24 2013 +0200 +++ b/OrthancServer/main.cpp Tue Apr 30 15:41:07 2013 +0200 @@ -56,9 +56,6 @@ MyDicomStore(ServerContext& context) : server_(context) { - LuaContext& lua = server_.GetLuaContext(); - lua.Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX); - lua.Execute("function NewInstanceFilter(dicom, aet) print(dicom['0010,0020'].Value); return true end"); } virtual void Handle(const std::string& dicomFile, @@ -234,6 +231,19 @@ context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false)); + { + std::string path = GetGlobalStringParameter("Scripting", ""); + if (path.size() > 0) + { + LOG(WARNING) << "Installing the Lua scripts from: " << path; + std::string lua; + Toolbox::ReadFile(lua, path); + context.GetLuaContext().Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX); + context.GetLuaContext().Execute(lua); + } + } + + try { context.GetIndex().SetMaximumPatientCount(GetGlobalIntegerParameter("MaximumPatientCount", 0));