qr.module
This package holds more than this page lists. See all of its files in its world.
README.md
qr
QR codes (ISO/IEC 18004, Model 2), drawn in Luau on every platform. encode turns a string into the grid of modules a phone's camera reads: byte mode (the text's UTF-8 bytes), the smallest version from 1 to 40 that holds it, the error correction raised as far as that version allows, and the mask the standard's penalty score prefers. svg draws a code as SVG markup with its quiet zone, for an svg widget or a texture.
Exports
encode(text, opts?)—{ size, version, ecc, mask, modules };opts.eccis"L","M"(the default),"Q"or"H",opts.mask(0-7) names the mask. Raises when the text is longer than a version 40 code holds.dark(code, x, y)— whether the module at columnx, rowy(from 0) is dark.svg(code, opts?)— the code as<svg>markup, one module per user unit;opts.border(4 unless named) is the quiet zone in modules,opts.darkandopts.lightthe two colours.
Example
local qr = require("@builtin::modules.qr")
local code = qr.encode("https://origozero.ai/link")
ui.registerScreen("link-qr", function()
return { type = "svg", props = { svg = qr.svg(code) }, style = { width = 200, height = 200 } }
end)