From accfd0f7a73930451574eb56a9302b4a16445ab7 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 29 May 2014 01:28:13 -0400 Subject: [PATCH] Add explicit operator bool for sol::object for even easier nil checking --- sol/object.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sol/object.hpp b/sol/object.hpp index 9aee1b52..0889a37f 100644 --- a/sol/object.hpp +++ b/sol/object.hpp @@ -45,6 +45,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&) {