mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Add explicit operator bool for sol::object for even easier nil checking
This commit is contained in:
parent
54f030873f
commit
accfd0f7a7
|
@ -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&) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user