Hi, list! I'm doing the following to scale squares and other stuff in
MetaPost/MetaFun. Although the following kinda works (maybe I'm just lucky
with this), I want to know how to do a better piece from it. I'm concerned
with passing data from Lua and TeX to Metapost and better ways to do it in
ConTeXt. Thank you in advance.

\starttext
My text

\startMPinitializations
numeric myunit;
myunit := \the\dimexpr1em\relax;
\stopMPinitializations
\startluacode

userdata = userdata or {}
userdata.dummydata = { {1, 2}, {3, 4} }

context.startMPcode()

for j=1,#userdata.dummydata do
for i=1,#userdata.dummydata[1] do
context("draw unitsquare scaled myunit shifted ((%d,%d)*myunit);",
userdata.dummydata[i][j], userdata.dummydata[i][j])
end
end

context.stopMPcode()

\stopluacode
\stoptext

Jairo :)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to