Hi, There's now a convenient way to pass data back from an mprun to the tex instance: \starttext \startMPcode passvariable("version","1.0") ; passvariable("number",123) ; passvariable("string","whatever") ; passvariable("point",(1,2)) ; passvariable("triplet",(1,2,3)) ; passvariable("quad",(1,2,3,4)) ; passvariable("boolean",false) ; passvariable("path",fullcircle scaled 1cm) ; draw fullcircle scaled 20pt ; \stopMPcode \ctxlua{inspect(metapost.variables)} \ctxcommand{mprunvar("number")} \ctxcommand{mprunvar("string")} \stoptext the inspect shows: table={ ["boolean"]=false, ["number"]=123, ["path"]={ { 10.02177, 10.02177, 12.67969, 7.36386, 7.36386, 12.67969 }, { 0, 14.17323, 3.75914, 14.17323, -3.75914, 14.17323 }, { -10.02177, 10.02177, -7.36386, 12.67969, -12.67969, 7.36386 }, { -14.17323, 0, -14.17323, 3.75914, -14.17323, -3.75914 }, { -10.02177, -10.02177, -12.67969, -7.36386, -7.36386, -12.67969 }, { 0, -14.17323, -3.75914, -14.17323, 3.75914, -14.17323 }, { 10.02177, -10.02177, 7.36386, -12.67969, 12.67969, -7.36386 }, { 14.17323, 0, 14.17323, -3.75914, 14.17323, 3.75914 }, }, ["point"]={ 1, 2 }, ["quad"]={ 1, 2, 3, 4 }, ["string"]="whatever", ["triplet"]={ 1, 2, 3 }, ["version"]="1.0", } the mprunvar pips a value or concatination to tex ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Indeed a challenge!
Alan
On Tue, 10 Sep 2013 18:11:13 +0200
Hans Hagen
Hi,
There's now a convenient way to pass data back from an mprun to the tex instance:
\starttext
\startMPcode passvariable("version","1.0") ; passvariable("number",123) ; passvariable("string","whatever") ; passvariable("point",(1,2)) ; passvariable("triplet",(1,2,3)) ; passvariable("quad",(1,2,3,4)) ; passvariable("boolean",false) ; passvariable("path",fullcircle scaled 1cm) ;
draw fullcircle scaled 20pt ; \stopMPcode
\ctxlua{inspect(metapost.variables)}
\ctxcommand{mprunvar("number")} \ctxcommand{mprunvar("string")}
\stoptext
the inspect shows:
table={ ["boolean"]=false, ["number"]=123, ["path"]={ { 10.02177, 10.02177, 12.67969, 7.36386, 7.36386, 12.67969 }, { 0, 14.17323, 3.75914, 14.17323, -3.75914, 14.17323 }, { -10.02177, 10.02177, -7.36386, 12.67969, -12.67969, 7.36386 }, { -14.17323, 0, -14.17323, 3.75914, -14.17323, -3.75914 }, { -10.02177, -10.02177, -12.67969, -7.36386, -7.36386, -12.67969 }, { 0, -14.17323, -3.75914, -14.17323, 3.75914, -14.17323 }, { 10.02177, -10.02177, 7.36386, -12.67969, 12.67969, -7.36386 }, { 14.17323, 0, 14.17323, -3.75914, 14.17323, 3.75914 }, }, ["point"]={ 1, 2 }, ["quad"]={ 1, 2, 3, 4 }, ["string"]="whatever", ["triplet"]={ 1, 2, 3 }, ["version"]="1.0", }
the mprunvar pips a value or concatination to tex
participants (2)
-
Alan BRASLAU
-
Hans Hagen