\starttext

% \enabletrackers[metapost.variables]

\startMPcode
    numeric n[]   ; for i=1 upto 10: n[i] := 1/i ; endfor ;
    path    p[]   ; for i=1 upto 10: p[i] := fullcircle xyscaled (cm*i,cm/i) ; endfor ;
    numeric r[][] ; for i=1 upto 4 : for j=1 upto 3 : r[i][j] := uniformdeviate(1) ; endfor ; endfor ;
    pair    u[][] ; for i=1 step 0.5 until 4 : for j=1 step 0.1 until 2 : u[i][j] := (i,j) ; endfor ; endfor ;

    passvariable("x",12345) ;
    passarrayvariable("n-array",n,1,7,1) ;
    passarrayvariable("p-array",p,1,7,1) ;
    passvariable("p",(1,1) .. (2,2)) ;

    startpassingvariable("b")
        startarray
            for i=1 upto 4 :
                startarray
                    for j=1 upto 3 :
                        value(r[i][j])
                    endfor
                stoparray
            endfor
        stoparray
    stoppassingvariable ;

    startpassingvariable("a")
        starthash
            key("test 1")
                startarray
                    value(123)
                    value(456)
                stoparray
            key("test 2")
                startarray
                    index(0)
                    value(123)
                    value(456)
                    value(789)
                    slot(999,987)
                stoparray
            key("test 3")
                starthash
                    key("first") value(789)
                    entry("second",987)
                stophash
        stophash
    stoppassingvariable ;

    startpassingvariable("c")
        startarray
            for i=1 step 0.5 until 4 :
                index(i)
                startarray
                    for j=1 step 0.1 until 2 :
                        slot(j,u[i][j])
                    endfor
                stoparray
            endfor
        stoparray
    stoppassingvariable ;

    draw fullcircle scaled 1cm ;
\stopMPcode

\ctxluacode{inspect(metapost.variables)}

\ctxcommand{mprunvar("x")}

\stoptext

