Hi, in an example document I’m trying to get pictures of random size and placement. Unfortunately the expansion is over my head: %%%%%%%%%%%%%%%%% \useMPlibrary[dum] \usemodule[visual] \startluacode local locations = { 'top', 'bottom', 'left', 'right', } function RandomLocation() context(locations[math.random(1,#locations)]) end \stopluacode \newdimen\PicWidth \PicWidth=\textwidth \define[1]\Blindbild{ \getrandomnumber\imgH{1}{9} \PicWidth=\textwidth \doif{#1}{left}{\PicWidth=.4\textwidth} \doif{#1}{right}{\PicWidth=.4\textwidth} \startplacefigure[location={#1},title={#1 \fakewords{3}{20}}] \externalfigure[place #1][width=\PicWidth,height=\dimexpr\textheight * \imgH / 10 \relax] \stopplacefigure } \starttext \dorecurse{3} {\chapter{\fakewords{5}{10}} \dorecurse{3} {\dorecurse{3}{\fakewords{50}{100}\endgraf} \Blindbild{\ctxlua{RandomLocation()}} % expansion!? \dorecurse{2}{\fakewords{50}{100}\endgraf}}} \stoptext %%%%%%%%%%%%%%%%%% So the parameter of \Blindbild should get generated at the time of calling the macro, so that #1 stays the same within the macro. In this state the Lua function gets called at every use of #1. Greetlings, Hraban --- https://www.fiee.net http://wiki.contextgarden.net https://www.dreiviertelhaus.de GPG Key ID 1C9B22FD