Neat use of Janet. You could also save the whole environment so you don’t have to stuff everything into stuff.
stuff
I actually tried that. The solution is found after I already wrote the article. The Janet’s official documentation about embedding is not working.
The solution is already in the source code. I didn’t mention it because it’s complicated.
Zig side:
const core_env = janet.Environment.init(null); const env = emptyEnvorinment(); // just an empty table env.proto = core_env; janet.gcRoot(env.toTable().wrap());
Janet side: (make-image (curenv))
(make-image (curenv))
Neat use of Janet. You could also save the whole environment so you don’t have to stuff everything into
stuff
.I actually tried that. The solution is found after I already wrote the article. The Janet’s official documentation about embedding is not working.
The solution is already in the source code. I didn’t mention it because it’s complicated.
Zig side:
Janet side:
(make-image (curenv))