Hi all, I would like to use a math function defined in lua in Metafun in order to draw its graph, together with the graphs of some other functions. As a simple example consider the following: %%% begin lua-metafun-example.tex \startluacode function document.myfunction(n,x) local S S = math.sin(n*x) return S end \stopluacode \starttext Here \type{document.myfunction(n,x)} is $\sin(nx)$. For instance when $n = 2$ and $x = 355/113$ we have: \type{document.myfunction(2,355/113)} $=\cldcontext{document.myfunction(2,355/113)} \sim 0$. \startplacefigure[title={Nothing works\dots}] \startMPcode{GridAxis} numeric gu ; gu = 5mm ; % gu = graph unit draw image ( draw function (1,"x","document.myfunction(2,x)", % <-- this does not work % draw function (1,"x","sin(2*x)", % <-- this works -355/113,355/113,.01) scaled gu withpen pencircle scaled .075pt withcolor darkred ; ) xsized .7TextWidth ; \stopMPcode \stopplacefigure \stoptext %%% end lua-metafun-example.tex Here one sees that the function « document.myfunction » is well defined in Lua and is known in ConTeXt, but I cannot use it in a Metapost code: how can one do that? Thanks in advance for any help. Best regards: Otared