LuaJIT library facilitating easy encoding and printing of strings as QR codes
Go to file
Jessie Hildebrandt 366bafc2be Add Table of Contents to README 2021-12-11 21:01:51 -05:00
bin Move Fennel binary 2021-10-07 15:58:40 -04:00
rockspec Add testing 2021-12-11 20:42:02 -05:00
spec Add testing 2021-12-11 20:42:02 -05:00
src Fix segfault when encoding 0-length string 2021-12-11 20:39:46 -05:00
.busted Add testing 2021-12-11 20:42:02 -05:00
.gitignore Add testing 2021-12-11 20:42:02 -05:00
.gitlab-ci.yml Add libqrencode-dev to CI pipeline 2021-12-11 20:43:53 -05:00
.luacov Add testing 2021-12-11 20:42:02 -05:00
LICENSE Initial commit 2021-10-07 01:55:46 -04:00
Makefile Update clean recipe in Makefile 2021-10-07 16:19:25 -04:00
README.md Add Table of Contents to README 2021-12-11 21:01:51 -05:00

README.md

qrprinter

A wrapper for libqrencode that provides an easy way of encoding and printing strings as QR codes from Lua.

This uses LuaJIT's FFI library, and so will not run in PUC Lua implementations.

Written in Fennel.

Test Status Code Coverage

Table of Contents

Installation

Install dependencies:

# Debian/Ubuntu:
apt install libqrencode-dev

# Alpine:
apk add gcompat libqrencode-dev

Install with luarocks:

luarocks install qrprinter

For a list of available versions, see the luarocks module page.

Example Usage

Documentation

Encoding

qrprinter.encode_string

qrprinter.encode_string( string )

Encodes string into a table representing a QR code.
Returns a two-dimensional sequential table of true/false values representing black/white QR modules.

Printing

All print functions accept an optional table options that may contain two keys:

  • invert: If non-nil, the output colors will be inverted
  • padding: Number of blanks cells to print around the QR code (default 2)

qrprinter.print_qr

qrprinter.print_qr( qr, [options] )

Print qr to stdout using ANSI escape sequences.
Alias of qrprinter.print_qr_ansi.

qrprinter.print_qr_ascii

qrprinter.print_qr_ascii( qr, [options] )

Print qr to stdout using ASCII characters.

qrprinter.print_qr_ansi

qrprinter.print_qr_ansi( qr, [options] )

Print qr to stdout using ANSI escape sequences.

qrprinter.print_qr_utf8

qrprinter.print_qr_utf8( qr, [options] )

Print qr to stdout using UTF8 block elements.

Testing

The Fennel code needs to be compiled before tests can be run:

# Build the project:
luarocks build

# Now you can run tests:
luarocks test