diff options
| -rw-r--r-- | pez.c | 9 | ||||
| -rw-r--r-- | pez.h | 2 |
2 files changed, 11 insertions, 0 deletions
@@ -4540,6 +4540,15 @@ pez_pushuserobj(PezContext *cx, const PezUserType *typeid, void *data) } bool +pez_setglobal(PezContext *cx, const char *name) +{ + Val k, v; + TRY(box_str(cx, &k, name, strlen(name))); + v = pop(cx); + return putglobal(cx, k, v); +} + +bool pez_isvoid(PezContext *cx, int idx) { return isvoid(*iget(cx, idx)); @@ -72,6 +72,8 @@ bool pez_pushstring(PezContext *, const char *str, int len); bool pez_pushglobal(PezContext *, const char *name); bool pez_pushuserobj(PezContext *, const PezUserType *, void *data); +bool pez_setglobal(PezContext *, const char *name); + bool pez_isvoid(PezContext *, int idx); bool pez_isnumber(PezContext *, int idx); bool pez_isbool(PezContext *, int idx); |