Hello, I have the following problem. Let's have T~.lua file which defines a function: --- function F2() context("draw (0,0)--(5cm,0)") end print("T~OK!") --- Let's have MP-02.ctx ConTeXt source file: --- \starttext AAA \startluacode function F() context("draw (0,0)--(2cm,0)") end require("T~") context.startMPcode() F() -- F2() context.stopMPcode() \stopluacode \stoptext --- Such code works OK - produces .pdf with a text "AAA" and a horizontal line. You can find the text "T~OK!" in the compilation log - that means T~.lua was successfully loaded. When I remove comment marks in front of F2() (which is defined in T~.lua), so I get: --- \starttext AAA \startluacode function F() context("draw (0,0)--(2cm,0)") end require("T~") context.startMPcode() F() F2() context.stopMPcode() \stopluacode \stoptext --- the compilation to .pdf fails with the following error message: --- MTXrun | run 1: luatex --fmt="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/f53042fa2e1c106bc7e3383ec8c3a00c/formats/cont-en" --lua="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/f53042fa2e1c106bc7e3383ec8c3a00c/formats/cont-en.lui" --backend=pdf "./MP -02.ctx"This is LuaTeX, Version beta-0.63.0-2010090921 (rev 3873) \write18 enabled. (MP-02.ctx jobcontrol > resuming randomizer with 0.40830713827937 ConTeXt ver: 2010.09.22 12:33 MKIV fmt: 2010.9.22 int: english/english system : cont-new loaded (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.tex systems : beware: some patches loaded from cont-new.tex (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv)) system : cont-fil loaded (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-fil.tex loading : ConTeXt File Synonyms ) system : cont-sys.rme loaded (c:/ConTeXt/tex/texmf-context/tex/context/user/cont-sys.rme (c:/ConTeXt/tex/texmf-context/tex/context/base/type-def.mkiv) (c:/ConTeXt/tex/texmf-context/tex/context/base/type-lua.mkiv) (c:/ConTeXt/tex/texmf-context/tex/context/base/type-siz.mkiv) (c:/ConTeX t/tex/texmf-context/tex/context/base/type-otf.mkiv)) system : cont-err loaded (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-err.tex systems : no file 'cont-sys.tex', using 'cont-sys.rme' instead ) system : MP-02.top loaded (MP-02.top) fonts : preloading latin modern fonts {c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-math.map}{c:/ConTeXt/tex/texmf/fonts/map/dvips/lm/lm-rm.map}{c:/ConTeXt/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map} bodyfont : 12pt rm is loaded language : language en is active publications : loading formatting style from bxml-apa (c:/ConTeXt/tex/texmf-context/tex/context/base/bxml-apa.mkiv) systems : begin file MP-02.ctx at line 1 T~OK! mplib : initializing instance 'metafun' using format 'metafun' mplib : loading 'metafun.mp' (experimental metapost version two) ! mp terminal: ! Extra tokens will be flushed. <to be read again> addto draw->addto .currentpicture.if.picture(EXPR0):also(EXPR0)else:doublepath(EXPR... <to be read again> ; <*> draw (0,0)--(2cm,0)draw (0,0)--(5cm,0); . system > error on line 4 in file MP-02.ctx: mp terminal: ! Extra tokens will be flushed. <to be read again> addto draw->addto .currentpicture.if.picture(EXPR0):also(EXPR0)else:doublepath(EXPR... <to be read again> ; <*> draw (0,0)--(2cm,0)draw (0,0)--(5cm,0); ... 1 \starttext 2 AAA 3 4 >> \startluacode 5 function F() 6 context("draw (0,0)--(2cm,0)") 7 end 8 9 require("T~") 10 11 context.startMPcode() 12 F() 13 F2() 14 context.stopMPcode() <inserted text> ...re.mp ; fi ; ;;;;]===], false)} \processMPgraphic ...e ;\!!es , \MPaskedfigure )}} \egroup \placeMPgraphic \d... l.4 \stopMPcode } context.stopMPcode() \dodostartluacode ...d \directlua \zerocount {#1}} l.15 \stopluacode --- It's strange to me, especially when body of F() and F2() is almost identical. Why? And how do I make it work (I mean still having a function defined in a separate file)? Thank you in advance. Cheers, Lukas