diff options
author | gumi <git@gumi.ca> | 2018-03-26 17:11:34 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-03-26 17:11:34 -0400 |
commit | 3a56da3c09845676534f460f75c8adb6c65fbb79 (patch) | |
tree | b37c703cc7dc07725235a5d916db5d83b65e8ecf /src/emap/script_buildins.c | |
parent | c3262df069c597bd3c56e167cadc077c077d0096 (diff) | |
download | evol-hercules-3a56da3c09845676534f460f75c8adb6c65fbb79.tar.gz evol-hercules-3a56da3c09845676534f460f75c8adb6c65fbb79.tar.bz2 evol-hercules-3a56da3c09845676534f460f75c8adb6c65fbb79.tar.xz evol-hercules-3a56da3c09845676534f460f75c8adb6c65fbb79.zip |
add missing hashtable iterator buildinss20180406
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r-- | src/emap/script_buildins.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 703307a..78fb940 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -1991,6 +1991,32 @@ BUILDIN(htIterator) return false; \ } +BUILDIN(htiFirstKey) +{ + int64 id = script_getnum(st, 2); + checkHtIteratorExists(id); + + const char * key = htreg->iterator_firstkey(id); + if (key) + script_pushstrcopy(st, key); + else + script_pushstrcopy(st, ""); + return true; +} + +BUILDIN(htiLastKey) +{ + int64 id = script_getnum(st, 2); + checkHtIteratorExists(id); + + const char * key = htreg->iterator_lastkey(id); + if (key) + script_pushstrcopy(st, key); + else + script_pushstrcopy(st, ""); + return true; +} + BUILDIN(htiNextKey) { int64 id = script_getnum(st, 2); @@ -2004,6 +2030,19 @@ BUILDIN(htiNextKey) return true; } +BUILDIN(htiPrevKey) +{ + int64 id = script_getnum(st, 2); + checkHtIteratorExists(id); + + const char * key = htreg->iterator_prevkey(id); + if (key) + script_pushstrcopy(st, key); + else + script_pushstrcopy(st, ""); + return true; +} + BUILDIN(htiCheck) { int64 id = script_getnum(st, 2); |