summaryrefslogtreecommitdiffhomepage
path: root/eval.h
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-17 13:57:22 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-20 20:45:26 +0200
commit9a74b811f007986a3e6015af0c06b33147d05951 (patch)
tree43e794cb1f35582c98eab8f8a1f4d54299cf2557 /eval.h
parent2601b1e17f5ba2e15fb16e126ec5d22a39246649 (diff)
eval: implement -m option to preload modules
The -m option instructs the interpreter to automatically require the named module and to register the module context as global variable. The following two commands are equivalent, with the former one serving as a shortcut for the latter: utpl -m fs -s '{{ fs.open("test.txt").read("all") }}' utpl -s '{% fs = require("fs"); print(fs.open("test.txt").read("all")) %}' Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.h')
-rw-r--r--eval.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/eval.h b/eval.h
index 090a4db..26f932f 100644
--- a/eval.h
+++ b/eval.h
@@ -43,6 +43,6 @@ struct json_object *
ut_invoke(struct ut_state *, uint32_t, struct json_object *, struct json_object *, struct json_object *);
enum ut_error_type
-ut_run(struct ut_state *state, struct json_object *env);
+ut_run(struct ut_state *state, struct json_object *env, struct json_object *modules);
#endif