diff --git a/sol/function_types.hpp b/sol/function_types.hpp index 8729e457..3b5c4158 100644 --- a/sol/function_types.hpp +++ b/sol/function_types.hpp @@ -267,11 +267,23 @@ struct userdata_function : public base_function { return (*this)(types(), t, L); } + + template> + typename std::enable_if::value, void>::type special_push(lua_State*, Return&&) { + // push nothing + } + + template> + typename std::enable_if::value, void>::type special_push(lua_State* L, Return&& r) { + stack::push(L, std::forward(r)); + } + template int operator()(types, types t, lua_State* L) { typedef typename return_type::type return_type; return_type r = stack::pop_call(L, fx, t); - stack::push(L, std::move(r)); + // stack::push(L, std::move(r)); + special_push(L, r); return sizeof...(Ret); }