\starttext

\startluacode
local metafun = context.metafun

local function barchart(t)
    local t = t.data
    metafun.start()
    for i=1,#t do
        metafun("draw unitsquare xyscaled(%s,%s) shifted (%s,0);",10,t[i]*10,i*10)
    end
    metafun.stop()
end

local t = { 1, 4, 6, 2, 3, }

barchart { data = t }
\stopluacode

\stoptext
