diff --git a/sol.hpp b/sol.hpp index fbf44a8f..ce093f66 100644 --- a/sol.hpp +++ b/sol.hpp @@ -26,4 +26,4 @@ #include "sol/object.hpp" #include "sol/function.hpp" -#endif // SOL_HPP \ No newline at end of file +#endif // SOL_HPP diff --git a/sol/demangle.hpp b/sol/demangle.hpp index 963782e7..09a32c29 100644 --- a/sol/demangle.hpp +++ b/sol/demangle.hpp @@ -68,4 +68,4 @@ std::string demangle(const std::type_info& id) { } // detail } // sol -#endif // SOL_DEMANGLE_HPP \ No newline at end of file +#endif // SOL_DEMANGLE_HPP diff --git a/sol/deprecate.hpp b/sol/deprecate.hpp index 59b23729..f00a6e12 100644 --- a/sol/deprecate.hpp +++ b/sol/deprecate.hpp @@ -32,4 +32,4 @@ #endif // compilers #endif // SOL_DEPRECATED -#endif // SOL_DEPRECATE_HPP \ No newline at end of file +#endif // SOL_DEPRECATE_HPP diff --git a/sol/error.hpp b/sol/error.hpp index e2eaa15c..d18398ea 100644 --- a/sol/error.hpp +++ b/sol/error.hpp @@ -32,4 +32,4 @@ public: }; } // sol -#endif // SOL_ERROR_HPP \ No newline at end of file +#endif // SOL_ERROR_HPP diff --git a/sol/function.hpp b/sol/function.hpp index a4055d09..5e6d0595 100644 --- a/sol/function.hpp +++ b/sol/function.hpp @@ -36,7 +36,7 @@ private: template std::tuple invoke(types, std::size_t n) { - luacall(n, sizeof...(Ret)); + luacall(n, sizeof...(Ret)); return stack::pop_reverse_call(state(), std::make_tuple, types()); } @@ -71,7 +71,7 @@ public: typename return_type::type operator()(types, Args&&... args) { return call(std::forward(args)...); } - + template typename return_type::type call(Args&&... args) { push(); diff --git a/sol/function_types.hpp b/sol/function_types.hpp index 23a02ce3..8729e457 100644 --- a/sol/function_types.hpp +++ b/sol/function_types.hpp @@ -19,8 +19,8 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#ifndef SOL_LUA_FUNC_HPP -#define SOL_LUA_FUNC_HPP +#ifndef SOL_FUNCTION_TYPES_HPP +#define SOL_FUNCTION_TYPES_HPP #include "stack.hpp" #include @@ -283,4 +283,4 @@ struct userdata_function : public base_function { } // sol -#endif // SOL_LUA_FUNC_HPP +#endif // SOL_FUNCTION_TYPES_HPP diff --git a/sol/object.hpp b/sol/object.hpp index ef7ae187..9ebae404 100644 --- a/sol/object.hpp +++ b/sol/object.hpp @@ -46,6 +46,10 @@ public: auto actual = lua_type(state(), -1); return (static_cast(expected) == actual) || (expected == type::poly); } + + explicit operator bool() const { + return is(); + } }; inline bool operator==(const object& lhs, const nil_t&) { @@ -65,4 +69,4 @@ inline bool operator!=(const nil_t&, const object& rhs) { } } // sol -#endif // SOL_OBJECT_HPP \ No newline at end of file +#endif // SOL_OBJECT_HPP diff --git a/sol/proxy.hpp b/sol/proxy.hpp index 00f641d1..e2bd8572 100644 --- a/sol/proxy.hpp +++ b/sol/proxy.hpp @@ -126,4 +126,4 @@ inline bool operator!= (const proxy& right, T&& left) { return right.template get>() != left; } -} // sol \ No newline at end of file +} // sol diff --git a/sol/reference.hpp b/sol/reference.hpp index 9acc75ed..8ccdad50 100644 --- a/sol/reference.hpp +++ b/sol/reference.hpp @@ -92,4 +92,4 @@ public: }; } // sol -#endif // SOL_REFERENCE_HPP \ No newline at end of file +#endif // SOL_REFERENCE_HPP diff --git a/sol/stack.hpp b/sol/stack.hpp index 1322ed45..067db106 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -68,9 +68,9 @@ inline T& get(types>, lua_State* L, int index = -1) { return *obj; } -template -inline T get(types, lua_State* L, int index = -1) { - return T(L, index); +template ::type> +inline U get(types, lua_State* L, int index = -1) { + return U(L, index); } template @@ -351,4 +351,4 @@ struct get_return { } // stack } // sol -#endif // SOL_STACK_HPP \ No newline at end of file +#endif // SOL_STACK_HPP diff --git a/sol/state.hpp b/sol/state.hpp index a3fd5a57..63f18713 100644 --- a/sol/state.hpp +++ b/sol/state.hpp @@ -208,4 +208,4 @@ public: }; } // sol -#endif // SOL_STATE_HPP \ No newline at end of file +#endif // SOL_STATE_HPP diff --git a/sol/table.hpp b/sol/table.hpp index 0cde0b83..bd67cfb2 100644 --- a/sol/table.hpp +++ b/sol/table.hpp @@ -261,4 +261,4 @@ private: }; } // sol -#endif // SOL_TABLE_HPP \ No newline at end of file +#endif // SOL_TABLE_HPP diff --git a/sol/traits.hpp b/sol/traits.hpp index acf8d55d..72c8de36 100644 --- a/sol/traits.hpp +++ b/sol/traits.hpp @@ -147,4 +147,4 @@ struct function_traits { }; } // sol -#endif // SOL_TRAITS_HPP \ No newline at end of file +#endif // SOL_TRAITS_HPP diff --git a/sol/tuple.hpp b/sol/tuple.hpp index 81240bb3..d73783cb 100644 --- a/sol/tuple.hpp +++ b/sol/tuple.hpp @@ -81,4 +81,4 @@ const auto default_constructor = constructors>{}; } // sol -#endif // SOL_TUPLE_HPP \ No newline at end of file +#endif // SOL_TUPLE_HPP diff --git a/sol/types.hpp b/sol/types.hpp index 6d17468b..987f8ce7 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -160,4 +160,4 @@ inline bool operator==(nil_t, nil_t) { return true; } inline bool operator!=(nil_t, nil_t) { return false; } } // sol -#endif // SOL_TYPES_HPP \ No newline at end of file +#endif // SOL_TYPES_HPP