Skip to content

Commit

Permalink
Added exists to check for selector existing in state
Browse files Browse the repository at this point in the history
C&P of the method @wileyyugioh provided here
jeremyong#58 (comment)
  • Loading branch information
adam4813 authored and ThePhD committed Aug 12, 2017
1 parent d930332 commit 6f8f200
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/selene/Selector.h
Expand Up @@ -404,6 +404,13 @@ class Selector {

friend bool operator==(const char *, const Selector &);

bool exists() {
ResetStackOnScopeExit save(_state);
_traverse();
_get();

return !lua_isnil(_state, -1);
}
private:
std::string ToString() const {
ResetStackOnScopeExit save(_state);
Expand Down

0 comments on commit 6f8f200

Please sign in to comment.