diff options
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); |