% !TeX program = LuaTeX
% Copyright (C) 2019-2022 Roberto Giacomelli

\newbox\mybox
\nopagenumbers

\directlua{
barracuda = require "barracuda"
local c39 = assert(
    barracuda:barcode()
             :new_encoder("code39", {debug_bbox_on = true})
)

local bars = c39:new {
    123456,
    "123456",
    "ABCDEF",
    87429,
    982398,
    "HDUHBE"
}

local canvas = barracuda:new_canvas()
local tx, ty = 0, 0
local dh = tex.sp "40pt"
for _, b in ipairs(bars) do
    b:draw(canvas, tx, ty)
    ty = ty + dh
end

local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}

Test 1: check Barcode recursive costructor new():
\bigskip
\leavevmode\box\mybox
\bye

