I hope this is a simple question, but I could not find documentation on it. Maybe I am searching for the wrong keywords.
I want to pass a star *
option to my lua code. I believe it is a boolean, based on code from an older project. \bool_if:NTF #1 {do true stuff}{do false stuff}
But something about passing a star as a parameter breaks the code.
\NewDocumentCommand{\addline}{smm}{\directlua{myluacodefile.addline(#1,"#2","#3")}}%
Here is a minimum "working" example
main.tex
\documentclass[letterpaper]{article}\usepackage{xparse}%for advanced command declaration\directlua{myluacodefile = require("myluacodefile")}%this links the .lua\newcommand{\sanitycheck}[2]{\directlua{myluacodefile.sanitycheck(#1,#2)}}%%\NewDocumentCommand{\addline}{mm}{\directlua{myluacodefile.addline("A","#1","#2")}}%turn this on to see the code "work"\NewDocumentCommand{\addline}{smm}{\directlua{myluacodefile.addline(#1,"#2","#3")}}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{document}hello\sanitycheck{1}{2}\addline{first}{second}\addline*{third}{fourth}\end{document}
myluacodefile.lua
local myluacodefile = {}--lua module startname = "Sanity Check"function myluacodefile.sanitycheck(a,b) c=a+b tex.print(c) tex.print(name)endfunction myluacodefile.addline(star, alpha, beta) local testa = alpha local testb = beta tex.print(testa) tex.print(testb)endreturn myluacodefile--lua module end