Thanks very much to Luigi. Your solution really works. Can you please explain why you doing this? My point is that if I have the LUA code in a separate lua file (loaded with the Contex via \directlua{dofile("filename.lua")}) (for example as a separate Lua function), so I'm probably not so to do (how you did it in your example). Or perhaps in this case there is any way? Thanks Jaroslav Dne 15.6.2012 9:41, luigi scarso napsal(a):
\def\setmybox{\setbox0=\vbox{\hsize=\lsize\input knuth \par}} \newdimen\lsize \lsize=5cm \starttext
Height of box via ConTeXt (works fine):
\setmybox
\lsize=5cm \dorecurse{3}{% \lsize=\dimexpr(\lsize+7mm) \setmybox height of box: \the\ht0\par width of box: \the\wd0\par \box0\par }
\page
... and Height of box via Lua (does it work ?):
\setmybox \ctxlua{tex.dimen.lsize=5*72.27*65536/25.4;i=0} \dorecurse{3}{% \ctxlua{ --[=[ for i=1, 3 do ]=] i=i+1 tex.dimen.lsize=tex.dimen.lsize+7*72.27*65536/25.4 context([[\setmybox]]) } \ctxlua{ local heightbox=tex.box[0].height local widthbox=tex.box[0].width heightbox=(heightbox*2.84527559067*25.4)/(72.27*65536) widthbox=(widthbox*2.84527559067*25.4)/(72.27*65536) context(i..[[ height of box:]]..heightbox.."pt : "..(tex.box[0].height/216).."pt\\par") context(i..[[ width of box:]]..widthbox.."pt : "..(tex.box[0].width/216).."pt\\par") context([[\box0\par]]) --[=[ end ]=] } } \stoptext