lua: loadstring returns compiled fn (errors propagate cleanly); parse-fail → (nil, err)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 21:12:12 +00:00
parent 12b02d5691
commit fc2baee9c7
4 changed files with 45 additions and 36 deletions

View File

@@ -1500,9 +1500,12 @@
(define
lua-loadstring
(fn (src)
(let ((compiled (lua-transpile src)))
(fn (&rest args)
(eval-expr (list (make-symbol "let") (list) compiled))))))
(guard
(e (true (list (quote lua-multi) nil (str e))))
(let ((compiled (lua-transpile src)))
(let ((wrapped (list (make-symbol "fn") (list (make-symbol "&rest") (make-symbol "__args"))
(list (make-symbol "let") (list) compiled))))
(eval-expr wrapped))))))
(define loadstring lua-loadstring)
(define load lua-loadstring)