lua: Lua 5.0-style arg auto-binding in vararg functions; assert-counter diagnostic +2 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 20:44:39 +00:00
parent 1d3a93b0ca
commit 46741a9643
6 changed files with 70 additions and 31 deletions

View File

@@ -1591,3 +1591,21 @@
;; T — debug/testC placeholder for tests that check it conditionally
(define T nil)
;; Build Lua 5.0-style `arg` table: array + .n counter, skipping leading explicit params.
(define
lua-varargs-arg-table
(fn (args skip)
(let ((t {}) (n 0))
(begin
(define
va-build
(fn (i)
(when (< i (len args))
(begin
(set! n (+ n 1))
(dict-set! t (str n) (nth args i))
(va-build (+ i 1))))))
(va-build skip)
(dict-set! t "n" n)
t))))