Am 13.08.2009 um 05:00 schrieb Aditya Mahajan:

You just need to work a little harder.

\startbuffer[1]
This is a test
\stopbuffer

\startbuffer[2]
Another test
\stopbuffer

\startbuffer[3]
And again
\stopbuffer

\startluacode
 userdata = userdata or {}
 function userdata.shift(i)
   return "(" .. i .. "cm ," .. i .. "cm )"
 end

 function userdata.buffers(i)
   local idx = string.format("%s",i)
   local b = buffers.data[idx]
   if b then
     if type(b) == "table" then
       return table.concat(b)
     else
       return b
     end
   else
     return "unknown"
   end
 end

 function userdata.draw_buffer(i)
   return "draw btex " .. userdata.buffers(i) .. " etex  shifted ".. userdata.shift(i) .. ";"
 end
\stopluacode

\starttext


\startluacode

 context.startMPpage({offset = "1ex", width = [[\paperwidth]], height = [[\paperheight]]})
   for i = 1,3 do
     context(userdata.draw_buffer(i))
   end
 context.stopMPpage()
\stopluacode

\stoptext

Thank you very much!

I played today (a couple of hours) with your solution and adapted some things, so if someone is interested, I've attached the file.

Attachment: MP-Luatext2.tex
Description: TeX document


PS. I like the math.random() function I found in the Lua manual.

Andreas
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to