qrcode.encode_string
code:Lua
qr = textmodule.qrcode.encode(black, white, str, ecc, min_ver, max_ver, mask, boost_ecc)
モジュール
引数
table:_
変数 型 概要
1 black string 黒のピクセルに使用する文字列
2 white string 白のピクセルに使用する文字列
3 str string 文字列
4 ecc number 誤り訂正レベル(1 - 4)(省略可)
5 min_ver number 最小バージョン(1 - 40)(省略可)
6 max_ver number 最大バージョン(1 - 40)(省略可)
7 mask number マスクパターン(-1 - 7)(省略可)
8 boost_ecc boolean 誤り訂正レベルを上げるかどうか(省略可)
返り値
table:_
変数 型 概要
1 qr string QRコード
概要
文字列strをQRコードに変換して取得する。
QRコードは文字列として取得でき、blackとwhiteで各ピクセルに使用する文字を指定する。
例
code:Lua
require("textmodule")
qr = textmodule.qrcode.encode_string("■", " ", "textmodule")
debug_print("\n" .. qr)
生成された文字列
code:Console
■■■■■■■ ■■ ■■■■■■■
■ ■ ■■■ ■ ■
■ ■■■ ■ ■ ■ ■ ■■■ ■
■ ■■■ ■ ■ ■ ■ ■■■ ■
■ ■■■ ■ ■■ ■ ■ ■■■ ■
■ ■ ■■ ■ ■
■■■■■■■ ■ ■ ■ ■■■■■■■
■ ■
■■■■■ ■■ ■■ ■■ ■ ■■
■■■ ■■ ■ ■ ■■ ■■
■ ■ ■■ ■■ ■ ■■■ ■
■■■■ ■ ■■■ ■■ ■■ ■■■■
■■ ■ ■■ ■■ ■
■ ■■
■■■■■■■ ■ ■ ■■ ■ ■
■ ■ ■■■■■ ■■■ ■
■ ■■■ ■ ■■■ ■■■■ ■■
■ ■■■ ■ ■ ■ ■■ ■
■ ■■■ ■ ■ ■ ■■ ■
■ ■ ■■■■■ ■■ ■ ■■
■■■■■■■ ■■■ ■■■■ ■ ■
実際のコンソールのスクリーンショット
https://scrapbox.io/files/623ec1c502bf9e001e65ce47.PNG