Is there any difference between
\startluacode? The commands seem to have a similar purpose, but I have found some code does compile properly if the wrong one is chosen. When is one used? When is the other?
The difference are the catcodes.
\startlua uses TeX catcodes,
startluacode uses Lua catcodes. Two examples:
\starttext \startlua -- fails both -- context("Foo %Bar") -- %context("Foo \n Bar") \stoplua \startluacode -- prints Foo -- context("Foo %Bar") -- prints Foo Bar context("Foo \n Bar") \stopluacode \stoptext
For more information you can have a look at the source file