1. 13
  1.  

    1. 3

      Neat use of Janet. You could also save the whole environment so you don’t have to stuff everything into stuff.

      1. 3

        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))