Hello ConTeXist and Lua experts Is there any way to refresh values between the values stored in Lua code and TeX registers? I need to evaluating the values of TeX registers (counters, dimensions, height of boxes, etc.) during the Lua cycle. I would like in the cycle read values from the TeX registers and write back there so that all values were always synchronized. Or I need advice on how to proceed. Most of my Lua code is in a separate file in Lua function. Is there a universal way to "jump out of cycle" to TeX synchronize all values between TeX registers and Lua values (even at the cost of slowing down) and then go back into the cycle and continue? I do not write cycles using the TeX macro language, but so far I'm failing in way around it. What I need to I knowing or What I need to learn? Thanx Jaroslav Hajtmar The minimal example shows (maybe) what I mean: \newcount\testcount \def\countrefresh{\directlua{tex.count.testcount = tex.count.testcount + 1}} \def\universalrefreshcommand{\directlua{-- ???}} \def\printdebuginfo{ \directlua{tex.sprint(': ',tex.count.testcount, " - ", "\\the\\testcount","\\par")} } \starttext Here values are not synchronized: \testcount=0 \startluacode local i=0 for i=1,5 do tex.sprint(i) tex.count.testcount = tex.count.testcount + 1 tex.sprint("\\printdebuginfo") end \stopluacode \blank[big] Here values of textcounter are synchronized: \testcount=0 \startluacode local i=0 for i=1,5 do tex.sprint(i) tex.sprint("\\countrefresh") tex.sprint("\\printdebuginfo") end \stopluacode \blank[big] Is there a universal way to "jump out of cycle" to TeX synchronize all values between TeX registers and Lua values (even at the cost of slowing down) and then go back into the cycle and continue? \testcount=0 \startluacode local i=0 for i=1,5 do tex.sprint(i) tex.count.testcount = tex.count.testcount + 1 tex.sprint("\\universalrefreshcommand") tex.sprint("\\printdebuginfo") end \stopluacode \blank[big] \stoptext