From: Remi Gacogne Date: Thu, 28 Jun 2018 09:04:49 +0000 (+0200) Subject: LuaWrapper: Add support for handling specialized unordered map as tables X-Git-Tag: dnsdist-1.3.1~13^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b59b2759f803112417ca5d1a8ba3e248ac4397c5;p=thirdparty%2Fpdns.git LuaWrapper: Add support for handling specialized unordered map as tables --- diff --git a/ext/luawrapper/include/LuaContext.hpp b/ext/luawrapper/include/LuaContext.hpp index fd22605c48..50fb4513e7 100644 --- a/ext/luawrapper/include/LuaContext.hpp +++ b/ext/luawrapper/include/LuaContext.hpp @@ -2113,12 +2113,12 @@ struct LuaContext::Pusher> { }; // unordered_maps -template -struct LuaContext::Pusher> { +template +struct LuaContext::Pusher> { static const int minSize = 1; static const int maxSize = 1; - static PushedObject push(lua_State* state, const std::unordered_map& value) noexcept { + static PushedObject push(lua_State* state, const std::unordered_map& value) noexcept { static_assert(Pusher::type>::minSize == 1 && Pusher::type>::maxSize == 1, "Can't push multiple elements for a table key"); static_assert(Pusher::type>::minSize == 1 && Pusher::type>::maxSize == 1, "Can't push multiple elements for a table value"); @@ -2777,16 +2777,16 @@ struct LuaContext::Reader> }; // unordered_map -template -struct LuaContext::Reader> +template +struct LuaContext::Reader> { static auto read(lua_State* state, int index) - -> boost::optional> + -> boost::optional> { if (!lua_istable(state, index)) return boost::none; - std::unordered_map result; + std::unordered_map result; // we traverse the table at the top of the stack lua_pushnil(state); // first key