Changes

Jump to navigation Jump to search
1,126 bytes added ,  08:17, 21 August 2012
Create entire page
{{Reference
|name=ctxlua
|attributes=
}}

== [[Help:Reference|Syntax]] ==
<table cellspacing="4" cellpadding="2" class="cmd">
<tr>
<td colspan="2" class="cmd">\ctxlua<!--
--><span class="first">{...}</span><!--
--></td>
</tr>
<tr valign="top" class="first">
<td class="cmd">{...}</td>
<td>''lua code''</td>
</tr>
</table>

== Description ==
Use this command to quickly execute some Lua code. TeX expands the argument ''before'' Lua receives it. Advantage: you can pass the contents of macro parameters like `#1` to Lua. Disadvantage: everything after a percent sign is ignored, and once the comments are processed out the linebreaks are stripped, too.

== Example ==
<context source=yes mode=mkiv>
\ctxlua{context(1+5)} % 6

%\ctxlua{context("5%")} % Is seen as `\ctxlua{context("5`

% 1, 2, 4, 8
\ctxlua{
context(1) % this comment is okay
i=2;
while i < 10 do
context(', ' .. i);
i = i*2
end}
</context>

== See also ==
* {{cmd|ctxcommand}}

== Help from ConTeXt-Mailinglist/Forum ==
All issues with:
{{Forum|{{SUBPAGENAME}}}}

[[Category:Command/LuaTeX|ctxlua]]

Navigation menu