Skip to content
Discussion options

You must be logged in to vote

Does this help?

(use mylib1)

# trick from: https://github.com/janet-lang/janet/discussions/1619
(def my-env (curenv))

(defn main [& args]
  (if (< (length args) 2)
    (do
      (print "Use: my_app <script.janet>")
      (os/exit 1)))

  (def script-path (get args 1))

  (print "[Janet Host]: Read external file: " script-path)
  
  (if (os/stat script-path)
    (do
      (print "--------------------------------------------------")
      (dofile script-path :env my-env)
      (print "--------------------------------------------------")
      (print "[Janet Host]: Done."))
    (print "[Janet Host]: Error: No file found!")))

Seems to work here:

$ jpm clean && jpm build
$ ./build/myexec scr…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@dmitrys99
Comment options

@dmitrys99
Comment options

@veqqq
Comment options

Answer selected by dmitrys99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants