Lua

Lua: Modules

A module is code that can be loaded using the require function. This code needs to create and return a table. The functions and constants that the module wishes to export get defined in this table. This table acts as a namespace.

Standard Libraries

The standard libraries are implemented as modules. You could do this:

local m = require "math"
print(m.sin(3.14))

As a convenience, The stand-alone interpreter loads all standard libraries using the name of the module as the variable name. E.g.:

math = require "math"
string = require "string"

require

Path searching

Module Structure

Tools

Web

Languages

Data