about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-12-17 10:33:49 +0900
committersefidel <contact@sefidel.net>2024-12-17 11:00:24 +0900
commit2ce25b32e37d1d58f09c37ab46cd346adc148dd5 (patch)
tree8d3521b0d2aff749b9c278d48924fed5bef9a610
parentad0732791c80d385deb9b116ebd60bcadd6119e5 (diff)
downloadnvimrc-2ce25b32e37d1d58f09c37ab46cd346adc148dd5.tar.gz
nvimrc-2ce25b32e37d1d58f09c37ab46cd346adc148dd5.zip
feat(macro/toolkit): allow passing arguments in vlua
-rw-r--r--fnl/nvrc/macro/toolkit.fnl8
1 files 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}