Mercurial > hg > orthanc
diff OrthancFramework/Sources/Lua/LuaFunctionCall.cpp @ 4819:70d2a97ca8cb openssl-3.x
integration mainline->openssl-3.x
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 13:12:32 +0100 |
parents | 94616af363ec |
children | 7053502fbf97 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Lua/LuaFunctionCall.cpp Mon Aug 30 22:21:24 2021 +0200 +++ b/OrthancFramework/Sources/Lua/LuaFunctionCall.cpp Thu Nov 25 13:12:32 2021 +0100 @@ -146,6 +146,20 @@ } } + void LuaFunctionCall::ExecuteToInt(int& result) + { + ExecuteInternal(1); + + int top = lua_gettop(context_.lua_); + if (lua_isnumber(context_.lua_, top)) + { + result = static_cast<int>(lua_tointeger(context_.lua_, top)); + } + else + { + throw OrthancException(ErrorCode_LuaReturnsNoString); + } + } void LuaFunctionCall::PushStringMap(const std::map<std::string, std::string>& value) {