6 – The Standard Libraries
All libraries are implemented through the official C API and are provided as separate C modules. Unless otherwise noted, these library functions do not adjust its number of arguments to its expected parameters. For instance, a function documented as foo(arg)
should not be called without an argument.
Currently, Lua has the following standard libraries:
- basic library (§6.1);
- coroutine library ();
- string manipulation (§6.4);
- basic UTF-8 support ();
- mathematical functions (§6.7) (sin, log, etc.);
- input and output ();
- debug facilities (§6.10).
To have access to these libraries, the C host program should call the function, which opens all standard libraries. Alternatively, the host program can open them individually by using luaL_requiref
to call luaopen_base
(for the basic library), luaopen_package
(for the package library), luaopen_coroutine
(for the coroutine library), luaopen_string
(for the string library), (for the UTF-8 library), luaopen_table
(for the table library), luaopen_math
(for the mathematical library), luaopen_io
(for the I/O library), luaopen_os
(for the operating system library), and luaopen_debug
(for the debug library). These functions are declared in .