Mercurial > hg > orthanc
comparison OrthancServer/LuaScripting.cpp @ 1587:d7e569640d09
New function "GetOrthancConfiguration()" to get the Orthanc configuration
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 Aug 2015 12:12:25 +0200 |
parents | 0c29ebe80ac9 |
children | 54bafe0e7e7b |
comparison
equal
deleted
inserted
replaced
1586:e088bc2c3a1a | 1587:d7e569640d09 |
---|---|
198 | 198 |
199 return 1; | 199 return 1; |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 // Syntax in Lua: GetOrthancConfiguration() | |
204 int LuaScripting::GetOrthancConfiguration(lua_State *state) | |
205 { | |
206 Json::Value configuration; | |
207 Configuration::GetConfiguration(configuration); | |
208 | |
209 LuaContext::GetLuaContext(state).PushJson(configuration); | |
210 | |
211 return 1; | |
212 } | |
213 | |
214 | |
203 IServerCommand* LuaScripting::ParseOperation(const std::string& operation, | 215 IServerCommand* LuaScripting::ParseOperation(const std::string& operation, |
204 const Json::Value& parameters) | 216 const Json::Value& parameters) |
205 { | 217 { |
206 if (operation == "delete") | 218 if (operation == "delete") |
207 { | 219 { |
355 lua_.SetGlobalVariable("_ServerContext", &context); | 367 lua_.SetGlobalVariable("_ServerContext", &context); |
356 lua_.RegisterFunction("RestApiGet", RestApiGet); | 368 lua_.RegisterFunction("RestApiGet", RestApiGet); |
357 lua_.RegisterFunction("RestApiPost", RestApiPost); | 369 lua_.RegisterFunction("RestApiPost", RestApiPost); |
358 lua_.RegisterFunction("RestApiPut", RestApiPut); | 370 lua_.RegisterFunction("RestApiPut", RestApiPut); |
359 lua_.RegisterFunction("RestApiDelete", RestApiDelete); | 371 lua_.RegisterFunction("RestApiDelete", RestApiDelete); |
372 lua_.RegisterFunction("GetOrthancConfiguration", GetOrthancConfiguration); | |
360 | 373 |
361 lua_.Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX); | 374 lua_.Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX); |
362 lua_.SetHttpProxy(Configuration::GetGlobalStringParameter("HttpProxy", "")); | 375 lua_.SetHttpProxy(Configuration::GetGlobalStringParameter("HttpProxy", "")); |
363 } | 376 } |
364 | 377 |