Re: runaway error: end of file encountered
Aditya Mahajan <[email protected]>
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 9 Apr 2026, Emanuel Han wrote:
> Sorry, some autocorrection of the mail program modified my copy-pasted mwe in my previous mail. I post it again here, this time not modified:
Here is MWE showing what is going wrong:
\starttext
\startluacode
local str = "\\startstackingsteps[1] ABC \\stopstackingsteps"
context(str)
\stopluacode
\stoptext
The reason this fails is that \startstacking is effectively a buffer; it stores everything until it sees a stopstacking and then processes it. Such mechanisms do not work from the lua end. For example:
\starttext
\startluacode
local str = "\\startbuffer[what] ABC \\stopbuffer"
context(str)
\stopluacode
\stoptext
Ironically, a simple fix is to go via the buffer route!
\starttext
\startluacode
local str = "\\startstackingsteps[1] ABC \\stopstackingsteps"
context.tobuffer("stacking", str)
context.getbuffer{"stacking"}
\stopluacode
\stoptext
This sets the buffer "stacking" at the lua level, and the context side only sees stuff when \getbuffer is called. Note that in the code above, context.getbuffer{...} is a shortcut for context.getbuffer({...}).
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________