The Lua Standard Libraries are a small collection of modules for performing common tasks such as manipulating strings, working with tables, input/out processing, and various other facilities for performing operating system services. The standard libraries functions are implemented directly through the C API.
Contents
Basic Library
- Main article: Basic Library - Lua
The Basic Library is composed of a set of core functions for the Lua language.
coroutine Library
- Main article: Coroutine Library - Lua
The Coroutine Library is a sub-library of the Basic Library that provides a set of functions for manipulating coroutines. All coroutines functions are exported inside the table coroutine.
Package Library
- Main article: Package Library - Lua
The Package Library provides the facilities for loading and building modules. With the exception of require and module, all package library functions are in the table package.
Mathematical Library
- Main article: Mathematical Library - Lua
The Mathematical Library provides a set of common mathematical functions such as trigonometric functions, exponentiation and logarithms, rounding functions, and various other math auxiliary functions such as maximum, minimum and pseudo-random generators. All mathematical functions resides inside the table math.
String Library
- Main article: String Library - Lua
The String Library provides a set of functions for manipulating strings, searching and extracting substrings, as well as pattern matching. String indexes are 1-based. Negative indices are interpreted as indexing backwards, from the end of the string. All string manipulating functions reside inside the table string. The string library assumes the strings are encoded using a one-byte encoding schemes.
Table Library
- Main article: Table Library - Lua
The Table Library provides generic functions for manipulating tables. Most of the functions assume that the table represents a list or an array. All table manipulation functions are inside the table table.
I/O Library
- Main article: I/O Library - Lua
The I/O Library provides a set of file manipulation functions in two styles: using implicit file descriptors and using explicit file descriptors. Table io also provides three predefined file descriptors: io.stdin, io.stdout, and io.stderr as the standard input, out and error streams.
OS Library
- Main article: OS Library - Lua
The OS Library provides a set of miscellaneous functions for various OS services such as time and date manipulation, temporary file, environment variable, and file renaming and removing.
Debug Library
- Main article: Debug Library - Lua
The Debug Library provides facilities for debugging and profiling Lua programs. All debug functions are provided inside the debug table.