luaguides

LuaGuides

Learn Lua

In-depth guides, tutorials, and a complete reference for Lua developers at every level.

42 guides · 20 reference entries · 57 tutorials

Latest guides

View all →
  1. Lua for MQTT and IoT Devices luaguides.dev/guides

    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.

  2. 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.

  3. 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.

  4. 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.

  5. 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 →
  1. Lua Fundamentals
  2. Lua Gamedev Love2d
  3. Lua Coroutines

Latest articles

View all →
  1. 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.