Changes

Jump to navigation Jump to search
no edit summary
tex.print("length " .. \string#t)}
</texcode>
 
 
== Calling a lua function with \cldcontext and get the return ==
 
One can execute a Lua code from within TeX and get back the result in TeX by using {{code|\cldcontext}}. Thus, if {{code|myfunction}} is a function of a variable {{code|x}} defined in Lua, {{code|\cldcontext{myfunction(5)}}} returns the value {{code|myfunction(5)}} in TeX. This is equivalent to {{code|\ctxlua{context(myfunction(5))}}}.
 
== A larger Lua block: \startluacode...\stopluacode ==
</pre></code>
= Calling Lua from TeX = One can execute a Lua code from within TeX and get back the result in TeX by using {{code|\cldcontext}}. Thus, if {{code|myfunction}} is a function of a variable {{code|x}} defined in Lua, {{code|\cldcontext{myfunction(5)}}} returns the value {{code|myfunction(5)}} in TeX. This is equivalent to {{code|\ctxlua{context(myfunction(5))}}}.=
Being a topic on itself, pages are dedicated:

Navigation menu