From 2ce25b32e37d1d58f09c37ab46cd346adc148dd5 Mon Sep 17 00:00:00 2001 From: sefidel Date: Tue, 17 Dec 2024 10:33:49 +0900 Subject: feat(macro/toolkit): allow passing arguments in vlua --- fnl/nvrc/macro/toolkit.fnl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fnl/nvrc/macro/toolkit.fnl b/fnl/nvrc/macro/toolkit.fnl index 8a2bc50..f5671df 100644 --- a/fnl/nvrc/macro/toolkit.fnl +++ b/fnl/nvrc/macro/toolkit.fnl @@ -31,9 +31,11 @@ [prefix object] (gensym-checksum prefix object "") [object] (gensym-checksum "" object ""))) -(lambda vlua [x] - "Return a symbol mapped to `v:lua.%s()`, where `%s` is the symbol." +(lambda vlua [x ...] + "Return a symbol mapped to `v:lua.%s(...)`, where `%s` is the symbol." (assert-compile (sym? x) "expected symbol for x" x) - (format "v:lua.%s()" (->str x))) + (format "v:lua.%s%s" + (->str x) + (.. "(" (table.concat (icollect [_ v (ipairs [...])] (->str v)) ", ") ")"))) {: fn? : gensym-checksum : vlua} -- cgit 1.4.1