diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-02-27 01:00:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-02-27 01:00:05 +0300 |
commit | 036e325e8a8be79a364004128eb2e9a936c0b393 (patch) | |
tree | 368bd552fce985b9c3257a9804c782485cc742a4 | |
parent | 9421aeddd73397479def88d6776f01ee16cba7b8 (diff) | |
download | plugin-036e325e8a8be79a364004128eb2e9a936c0b393.tar.gz plugin-036e325e8a8be79a364004128eb2e9a936c0b393.tar.bz2 plugin-036e325e8a8be79a364004128eb2e9a936c0b393.tar.xz plugin-036e325e8a8be79a364004128eb2e9a936c0b393.zip |
Add script function for check is hash table exists.
New script function: htexists.
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 6 | ||||
-rw-r--r-- | src/emap/script_buildins.h | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 85d9bc5..ecd0de9 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -181,6 +181,7 @@ HPExport void plugin_init (void) addScriptCommand("htclear", "i", htClear); addScriptCommand("htdelete", "i", htDelete); addScriptCommand("htsize", "i", htSize); + addScriptCommand("htexists", "i", htExists); addScriptCommand("htiterator", "i", htIterator); addScriptCommand("htinextkey", "i", htiNextKey); addScriptCommand("hticheck", "i", htiCheck); diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 520f16f..6359ff6 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -1965,6 +1965,12 @@ BUILDIN(htSize) return true; } +BUILDIN(htExists) +{ + int64 id = script_getnum(st, 2); + script_pushint(st, htreg->hashtable_exists(id)); +} + BUILDIN(htIterator) { int64 id = script_getnum(st, 2); diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index 176feb0..2066432 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -80,6 +80,7 @@ BUILDIN(htPut); BUILDIN(htClear); BUILDIN(htDelete); BUILDIN(htSize); +BUILDIN(htExists); BUILDIN(htIterator); BUILDIN(htiNextKey); BUILDIN(htiCheck); |