lua: string metatable, high-byte chars, multi-return truthy, perf

This commit is contained in:
2026-04-25 11:15:12 +00:00
parent dd47fa8a0b
commit 8ca5c8052d
7 changed files with 196 additions and 121 deletions

View File

@@ -1008,6 +1008,12 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 1925)
(eval "(lua-eval-ast \"return string.format('%.3s', 'hello')\")")
;; ── New-style vararg: arg is nil when ... used in body ──────
(epoch 1930)
(eval "(lua-eval-ast \"function f(...) local x = {...} return arg == nil and 1 or 0 end return f(1,2,3)\")")
(epoch 1931)
(eval "(lua-eval-ast \"function f(...) return select('#', ...) end return f(10,20,30)\")")
EPOCHS
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1530,6 +1536,10 @@ check 1923 "%X HEX" '"FF"'
check 1924 "%c char" '"A"'
check 1925 "%.3s precision" '"hel"'
# ── New-style vararg: arg is nil when ... used in body ───────
check 1930 "new-style vararg arg==nil" '1'
check 1931 "select # vararg count" '3'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"