Add explicit operator bool for sol::object for even easier nil checking

This commit is contained in:
Rapptz 2014-05-29 01:28:13 -04:00
parent 54f030873f
commit accfd0f7a7

View File

@ -45,6 +45,10 @@ public:
auto actual = lua_type(state(), -1); auto actual = lua_type(state(), -1);
return (static_cast<int>(expected) == actual) || (expected == type::poly); return (static_cast<int>(expected) == actual) || (expected == type::poly);
} }
explicit operator bool() const {
return is<nil_t>();
}
}; };
inline bool operator==(const object& lhs, const nil_t&) { inline bool operator==(const object& lhs, const nil_t&) {