Sample code for 30+ languages & platforms
Lua Requires Chilkat v11.7.0+

Get the QR Code Capabilities of the Chilkat Version in Use

See more QR Code Examples

Demonstrates the capabilities operation, which describes what the installed version of Chilkat can do: the range of QR versions, the error-correction levels, the operations, the image formats and the limits. A program can check for a feature here instead of testing for a Chilkat version number. The request can be an empty JSON object.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.

local json = chilkat.JsonObject.new()
local fmt = chilkat.Formats.new()
local jsonOut = chilkat.JsonObject.new()
local success = fmt:qr_code("capabilities", json, jsonOut)
if not success then
    print(fmt.last_error_text)
    return
end

print("Chilkat version: " .. jsonOut:string_of("productVersion"))
print("symbology: " .. jsonOut:string_of("symbologies[0].id"))
print("QR versions: " .. jsonOut:int_of("symbologies[0].encoding.version.min") .. " to " .. jsonOut:int_of("symbologies[0].encoding.version.max"))
print("structured append, most symbols: " .. jsonOut:int_of("symbologies[0].structuredAppend.maxSymbols"))

local n = jsonOut:size_of_array("symbologies[0].encoding.errorCorrection")
for i = 0, n - 1 do
    jsonOut.i = i
    print("error correction: " .. jsonOut:string_of("symbologies[0].encoding.errorCorrection[i]"))
end

-- The operations this version implements.
n = jsonOut:size_of_array("operations")
for i = 0, n - 1 do
    jsonOut.i = i
    if jsonOut:bool_of("operations[i].available") then
        print("operation: " .. jsonOut:string_of("operations[i].name"))
    end
end

n = jsonOut:size_of_array("imageFormats.output")
for i = 0, n - 1 do
    jsonOut.i = i
    print("image format: " .. jsonOut:string_of("imageFormats.output[i]"))
end

print("default timeout: " .. jsonOut:int_of("limits.timeoutMs.default") .. " ms")
print("default largest image: " .. jsonOut:int_of("limits.maxPixels.default") .. " pixels")

-- Sample output:

-- Chilkat version: 11.7.0
-- symbology: qr
-- QR versions: 1 to 40
-- structured append, most symbols: 16
-- error correction: auto
-- error correction: L
-- error correction: M
-- error correction: Q
-- error correction: H
-- operation: generate
-- operation: measure
-- operation: validate
-- operation: capabilities
-- image format: png
-- image format: svg
-- default timeout: 10000 ms
-- default largest image: 16777216 pixels