% !TeX program = LuaTeX

\newbox\mybox
\nopagenumbers
\directlua{
local barracuda = require "barracuda"
local barcode = barracuda:barcode()
local driver = barracuda:get_driver()
local mm = driver.mm

local canvas = barracuda:new_canvas()
canvas:encode_linewidth(1*mm)

canvas:encode_dash_pattern(0, 2*mm)
canvas:encode_hline(0, 30*mm, 5*mm)

canvas:encode_dash_pattern(0, 2*mm, 4*mm)
canvas:encode_hline(0, 30*mm, 10*mm)

canvas:encode_dash_pattern(1*mm, 2*mm, 2*mm, 4*mm)
canvas:encode_hline(0, 30*mm, 15*mm)

canvas:encode_linewidth(0.05*mm)
canvas:encode_reset_pattern()
for i=0, 15 do
    canvas:encode_vline(0, 20*mm, i*2*mm)
end

canvas:encode_dash_pattern(0.5*mm, 1*mm)
canvas:encode_polyline{
    1*mm, 1*mm,
    29*mm, 1*mm,
    29*mm, 19*mm,
    1*mm, 19*mm,
    1*mm, 1*mm
}

driver:save("svg", canvas, "test")
assert(driver:ga_to_hbox(canvas, [[mybox]]))
}\leavevmode\box\mybox
\bye