---
product: Chilkat
product_version: 11.7.0
language: lua
language_label: Lua
document: language guide
---
> Chilkat 11.7.0 · language=lua · this file: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/lua/guide.md`
> Class pages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/lua/classes/<Class>.md`

# Chilkat for Lua — language guide — v11.7.0

> This guide has only generated sections so far. The class pages carry the per-member detail.

## Object creation, unlocking and error handling

**Object Creation**

```lua
local chilkat = require("chilkat")

local glob = chilkat.Global.new()
```

`local glob = chilkat.Global.new()`

Creates the object (`chilkat.Global()` does the same). Lua's garbage collector frees it when it is no longer referenced; `glob:dispose()` frees it at once, and in Lua 5.4 and later `local glob <close> = chilkat.Global.new()` frees it when the block ends. Calling a method of a disposed object raises an error.

**Errors**

A method that fails returns `nil` followed by the error text, as `io.open` does: `local body, err = glob:method(...)`, where `err` is the object's `last_error_text`. Wrap the call in `assert()` to raise an error with that text instead. Methods that answer a question return `true` or `false`, numbers are returned as they are (check `last_method_success` where the description says a value means failure), and property reads and writes never fail for Chilkat reasons.

Misuse raises a Lua error: a wrong argument type or a missing argument (`bad argument #1 to ...`), an unknown property name, a write to a read-only property, an out-of-range integer, or an object of the wrong class.

Names are Chilkat's in snake_case: `QuickGetStr` is `quick_get_str`, `LastErrorText` is `last_error_text`. Properties are fields (`glob.verbose_logging = true`) and methods use the colon (`glob:method(...)`). Strings are UTF-8; binary data is a Lua string of bytes. Indexes are 0-based, as in every Chilkat API. Unlocking: call `chilkat.unlock_bundle("...")` once at startup.

Literals in Lua: true is `true`, false is `false`, null/none is `nil`.

## Classes

[Class index for Lua](https://www.chilkatsoft.com/ai-docs/v/11.7.0/lua/index.md)
