Learn how to use MQTT to connect Lua applications to IoT devices with this practical guide covering pub/sub patterns, QoS levels, and real-world code examples.
Latest guides
View all →- Lua for MQTT and IoT Devices luaguides.dev/guides
- Cross-Platform Scripting with Lua luaguides.dev/guides
Write Lua scripts that run on Windows, macOS, and Linux. Covers paths, line endings, executable discovery, and platform detection.
- Dependency Management Patterns in Lua luaguides.dev/guides
Manage Lua dependencies with luarocks, submodule imports, and inline bundles. Find the right approach for your project size and deployment target.
- Event Systems and Message Passing in Lua luaguides.dev/guides
Build a simple event system in plain Lua. Covers callbacks, publish-subscribe, message queues, and integrating with game loops or OpenResty request handling.
- Logging Patterns and Frameworks in Lua luaguides.dev/guides
Add timestamps, log levels, and output to files with plain Lua. Then level up with LuaLogging or build your own structured logger.
Reference
View all →| Name | Section | Description |
|---|---|---|
string.find | String Methods | Search for a pattern in a Lua string and return the start and end positions. Supports Lua patterns or plain literal search via the optional plain argument. |
string.gsub | String Methods | Replace pattern matches in a Lua string. Accepts a literal replacement, a table lookup, or a function that returns the replacement for each match. |
table.insert | Table Methods | Insert a value into a Lua table at a given position, shifting later elements up. Without a position, table.insert appends to the array part of the table. |
setmetatable | Core Functions | Assign a metatable to a table, enabling custom behavior for operators, indexing, and function calls. |
rawlen | Core Functions | Get table or string length without calling the __len metamethod. |
next | Core Functions | Traverse Lua tables in arbitrary order with next(). Returns the next key-value pair or nil when the table is empty. |
Tutorial series
View all →Latest articles
View all →- Why Lua docs work best with minimal complete snippets luaguides.dev/articles
Lua documentation is easiest to learn from when examples are small, complete, and runnable without extra framework noise.