Tables

See the Table section in the frontend module documentation for complete table API reference.

Quick Example

local frontend = require("glu.frontend")

local tbl = frontend.table({
    max_width = "15cm",
    stretch = true
})

tbl:set_columns({ "5cm", "10cm" })

local row = tbl:add_row()

local cell1 = row:add_cell()
cell1:set_contents("First column")
cell1.halign = "left"

local cell2 = row:add_cell()
cell2:set_contents("Second column")
cell2.padding_left = "5mm"

local vlists = doc:build_table(tbl)
for _, vl in ipairs(vlists) do
    page:output_at("2cm", y, vl)
    y = y - vl.height
end