Lua Integration

Please note these are examples. It is recommended that you make one that is more complex and adjustable to your needs.

Example Lua

Copy

local http = require("socket.http")
local json = require("cjson")

function checkLicense(key, software, version)
    local secret = 'PUT_YOUR_SECRET_KEY'
    local type = 'license'
    local domain = "<YOUR_DOMAIN>"
    local url = string.format("https://%s/api.php?secret=%s&type=%s&key=%s&product=%s&version=%s",
        domain, secret, type, key, software, version)

    local response, status = http.request(url)

    if status ~= 200 then
        print("Error...")
        os.exit()
    end

    local data = json.decode(response)

    if data.valid then
        print("Success!")
    else
        print("Incorrect.")
    end
end

-- Use example
checkLicense("your_key", "your_software", "your_version")

Last updated