Changes

Jump to navigation Jump to search
m
emphasize a block element abusing the blockquote
There are two main ways to execute Lua code in a ConTeXt document: The command {{cmd|ctxlua}}, and the environment {{cmd|startluacode}}…{{cmd|stopluacode}}. Both are wrappers around the LuaTeX primitive {{cmd|directlua}}, which you should never need to use. In general, you will define a function inside a {{cmd|startluacode}} block, and then define a TeX command that calls the function using {{cmd|ctxlua</code>, especially because {{cmd|ctxlua}} has a few idiosyncracies.
<blockquote>The main thing about Lua code in a TeX document is this: the code is expanded by TeX ''before'' Lua gets to it. '''This means that all the Lua code, even the comments, must be valid TeX!''' A string like {{cmd|undefined}} will cause an immediate failure.</blockquote>
== Calling a bit of Lua inline: {{cmd|ctxlua}} ==
139

edits

Navigation menu