diff --git a/sol/function.hpp b/sol/function.hpp index 8fd1a326..e9433732 100644 --- a/sol/function.hpp +++ b/sol/function.hpp @@ -80,12 +80,12 @@ public: } template - typename return_type::type operator()(types, Args&&... args) const { + ReturnType operator()(types, Args&&... args) const { return call(std::forward(args)...); } template - typename return_type::type call(Args&&... args) const { + ReturnType call(Args&&... args) const { push(); int pushcount = stack::push_args(state(), std::forward(args)...); auto tr = types(); diff --git a/sol/state.hpp b/sol/state.hpp index bb2d0080..befdeb0c 100644 --- a/sol/state.hpp +++ b/sol/state.hpp @@ -95,13 +95,13 @@ public: luaL_requiref(L.get(), "package", luaopen_package, 1); lua_pop(L.get(), 1); break; - case lib::coroutine: #if SOL_LUA_VERSION > 501 + case lib::coroutine: luaL_requiref(L.get(), "coroutine", luaopen_coroutine, 1); lua_pop(L.get(), 1); -#endif // Lua 5.2+ only break; - case lib::string: +#endif // Lua 5.2+ only + case lib::string: luaL_requiref(L.get(), "string", luaopen_string, 1); lua_pop(L.get(), 1); break; diff --git a/sol/traits.hpp b/sol/traits.hpp index 4e6478c8..2e9653a8 100644 --- a/sol/traits.hpp +++ b/sol/traits.hpp @@ -118,10 +118,13 @@ struct return_type { }; template<> -struct return_type<> : types<>{ +struct return_type<> { typedef void type; }; +template +using ReturnType = typename return_type::type; + namespace detail { template>::value>