Chilkat for Lua — Downloads
Chilkat for Lua is the Chilkat library as a Lua C module: local chilkat = require("chilkat"),
classes such as chilkat.Http and chilkat.JsonObject, snake_case members
(http:quick_get_str(url), http.connect_timeout = 30), failures returned as
nil, err, progress callbacks as plain functions, and LuaLS annotations for editor completion.
HTTP and REST, email, FTP, SFTP, SSH, zip, encryption, signatures, certificates, XML, JSON, sockets and more, for
Lua 5.1 (and LuaJIT), 5.4 and 5.5 on Windows, Linux, Alpine Linux and macOS.
# Linux, Alpine Linux, macOS (as root if the Lua directories need it: ... | sudo sh) curl -fsSL https://chilkatdownload.com/lua/install.sh | sh # Windows (PowerShell) irm https://chilkatdownload.com/lua/install.ps1 | iex
The installer asks your Lua for its version (5.1/LuaJIT, 5.4 or 5.5) and its package.cpath, detects
the platform, downloads the matching build from this page, puts chilkat.so / chilkat.dll into
the first writable module directory and checks that require "chilkat" works. Options:
--lua=PATH, --dest=DIR, --dry-run (PowerShell: -Lua, -Dest,
-DryRun).
luarocks install chilkat --server=https://chilkatdownload.com/luarocks/lua5.4 # Lua 5.1 or LuaJIT: .../luarocks/lua5.1 Lua 5.5: .../luarocks/lua5.5 # Alpine Linux: .../luarocks/lua5.4-musl (lua5.1-musl, lua5.5-musl)
Chilkat's own LuaRocks repositories on chilkatdownload.com hold prebuilt binary rocks — nothing is compiled.
A rock is tied to its Lua version, so LuaRocks refuses one built for another Lua. luarocks remove chilkat
uninstalls it.
Jump to: Which download? · Windows · Linux · Alpine Linux · macOS · Getting started · The API in brief · Troubleshooting
Documentation & Samples
- 📖 Chilkat Lua Reference Documentation — every class, method and property with its Lua signature
- 💻 Chilkat Lua Sample Code — complete, ready-to-run examples
- 📦 In every download:
types/chilkat.lua, the LuaLS annotations — add thetypesdirectory toworkspace.libraryfor completion and type checking - 📝 Release Notes on the Chilkat blog
Which download do I need?
A Lua C module is built for one Lua version line, so each download is for one Lua ABI and one platform:
| Your interpreter | Download |
|---|---|
| Lua 5.1, LuaJIT 2.0 / 2.1 (also OpenResty) | chilkat-lua5.1-<platform> |
| Lua 5.4 | chilkat-lua5.4-<platform> |
| Lua 5.5 | chilkat-lua5.5-<platform> |
| Lua 5.2, 5.3 | not built |
lua -v # which Lua lua -e "print(_VERSION, package.cpath)" # its version and where it looks for C modules
Platforms: Windows (win32, x64, arm64), Linux glibc (x86_64, aarch64, armv7l), Alpine Linux musl (x86_64, aarch64), macOS (arm64, x86_64). The Linux builds do not load on Alpine, nor the reverse.
Windows
Each .zip contains a code-signed chilkat.dll, linked with the C runtime statically (no
redistributable needed). The DLL imports the Lua C API by name from lua51.dll, lua54.dll or
lua55.dll — whichever your lua.exe uses, MSVC- or MinGW-built, LuaJIT's
lua51.dll included. Getting started →
Linux (x86_64, aarch64, armv7l)
For glibc-based distributions (Debian/Ubuntu, RHEL/Fedora, SUSE, Arch, Raspberry Pi OS, …). Each
.tar.gz contains chilkat.so. Alpine Linux uses musl and needs the Alpine downloads below.
Getting started →
Alpine Linux (x86_64, aarch64)
For musl-based systems (Alpine Linux, including the official Alpine Docker images).
macOS (Apple silicon, Intel)
Each .tar.gz contains a code-signed chilkat.so (the extension Lua looks for on macOS too).
Homebrew's lua (5.4) and luajit work with these.
Getting started
-
Download and extract
tar xzf chilkat-lua5.4-x86_64-linux.tar.gz # Linux / Alpine / macOS (your file name) # Windows: right-click the .zip → Extract All, or: tar -xf chilkat-lua5.4-x64.zip
macOS only: if the browser added a quarantine attribute, clear it so Gatekeeper does not block the module:
xattr -dr com.apple.quarantine chilkat-lua5.4-arm64-macosx -
What's in the download
chilkat-lua<abi>-<platform>/ ├─ chilkat.so the module (chilkat.dll on Windows) ├─ types/chilkat.lua LuaLS annotations for editors ├─ test.lua checks that the module loads ├─ README.txt └─ license files and a software bill of materials (chilkat.cdx.json)
-
Try it without installing
From the extracted folder (
test.luaadds the current directory topackage.cpath):lua test.lua
-
Install
Copy
chilkat.so(orchilkat.dll) into a directory on your Lua'spackage.cpath— e.g./usr/local/lib/lua/5.4, or on Windows the directory oflua.exe— or pointLUA_CPATHat its directory (LUA_CPATH="/opt/chilkat/?.so;;"). Or use the one-command installer or LuaRocks above. -
Unlock
Chilkat is fully functional for a 30-day trial. Call
unlock_bundleonce when your program starts; any string starts the trial, and your purchased unlock code is used the same way:assert(chilkat.unlock_bundle("Anything for 30-day trial"))
A first program
local chilkat = require("chilkat")
assert(chilkat.unlock_bundle("Anything for 30-day trial"))
local http = chilkat.Http.new()
http.connect_timeout = 10 -- properties are fields
http:set_event_handler({
percent_done = function(pct) io.write(pct, "%\r") end, -- return true to abort
})
local html, err = http:quick_get_str("https://www.chilkatsoft.com/")
if not html then
print(err) -- the reason: http.last_error_text
os.exit(1)
end
print("HTTP " .. http.last_status .. ", " .. #html .. " bytes")
local json = chilkat.JsonObject.new()
assert(json:load('{"a":1,"b":"x"}')) -- assert() raises with the Chilkat log
print(json:int_of("a"), json:string_of("b"))
The API in brief
The same classes, members and behavior as every other Chilkat product, in Lua style.
| Chilkat for Lua | |
|---|---|
| Loading | local chilkat = require("chilkat") |
| Objects | local http = chilkat.Http.new() |
| Properties | http.connect_timeout = 30 local t = http.connect_timeout |
| Methods | http:quick_get_str(url) |
| Names | Chilkat's names in snake_case: QuickGetStr → quick_get_str,
LastErrorText → last_error_text; class names as in Chilkat, without Ck |
| Failure | returns nil, err (err is the object's last_error_text), as
io.open does; wrap the call in assert() to raise instead |
| Questions | methods that answer a question (json:has_member, zip:entry_of) return
true / false |
| Misuse | a wrong argument type, a missing argument, an unknown or read-only property raise a Lua error |
| Strings and bytes | UTF-8 strings in and out; binary data as Lua strings (bd:get_data()) |
| Progress events | obj:set_event_handler{ percent_done = function(pct) ... end, abort_check = ..., progress_info = ... };
a true return aborts the method |
| Lifetime | garbage collected; obj:dispose() frees early, and in Lua 5.4+ local http <close> = ... |
| Indexes | 0-based, as in all Chilkat APIs: for i = 0, json.size - 1 do |
| Async | no *Async methods; bound long calls with heartbeat_ms + abort_check |
Troubleshooting
module 'chilkat' not foundchilkat.so/chilkat.dllis not in any directory ofpackage.cpathof the Lua that runs the script: print it withlua -e "print(package.cpath)", or setLUA_CPATH.undefined symbol: lua_newuserdatauv(or anotherlua_function)- The download is for another Lua version: use
chilkat-lua5.1-*for Lua 5.1 and LuaJIT,chilkat-lua5.4-*for 5.4,chilkat-lua5.5-*for 5.5. It can also mean the host program was built without exporting the Lua API (a statically linked Lua that cannot load any C module). - Windows:
The specified module could not be found - The module imports the Lua API from
lua51.dll/lua54.dll/lua55.dll. A Lua whose DLL has another name (for examplelua5.4.dll), or alua.exewithout a Lua DLL, cannot load it; use a build with the standard DLL name (LuaBinaries, LuaJIT, MSYS2, vcpkg). Error loading shared libraryon Alpine (or the reverse)- A glibc (Linux) build on Alpine Linux, or an Alpine build on a glibc distribution: use the download for the C library of the system.
- macOS: the module “cannot be opened” or fails a code-signature check
- Clear the download's quarantine attribute:
xattr -dr com.apple.quarantine <extracted folder>. chilkat.Http has no property 'conect_timeout'- Property names are checked: a misspelled property raises an error instead of being silently ignored.