*luaref.txt* Nvim
*luaref*
LUA REFERENCE MANUAL
Version 0.3.0
August 7th, 2022
Vimdoc version (c) 2006 by Luis Carvalho
<lexcarvalho at gmail dot com>
Adapted from "Lua: 5.1 reference manual"
R. Ierusalimschy, L. H. de Figueiredo, W. Celes
Copyright (c) 2006 Lua.org, PUC-Rio.
See |lua-ref-doc| for information on this manual.
See |lua-ref-copyright| for copyright and licenses.
Type |gO| to see the table of contents.
==============================================================================
1 INTRODUCTION *luaref-intro*
Lua is an extension programming language designed to support general
procedural programming with data description facilities. It also offers good
support for object-oriented programming, functional programming, and
data-driven programming. Lua is intended to be used as a powerful,
light-weight scripting language for any program that needs one. Lua is
implemented as a library, written in clean C (that is, in the common subset of
ANSI C and C++).
Being an extension language, Lua has no notion of a "main" program: it only
works embedded in a host client, called the embedding program or simply the
host. This host program can invoke functions to execute a piece of Lua code,
can write and read Lua variables, and can register C functions to be called by
Lua code. Through the use of C functions, Lua can be augmented to cope with a
wide range of different domains, thus creating customized programming
languages sharing a syntactical framework.
Lua is free software, and is provided as usual with no guarantees, as stated
in its license. The implementation described in this manual is available at
Lua's official web site, www.lua.org.
Like any other reference manual, this document is dry in places. For a
discussion of the decisions behind the design of Lua, see references at
|lua-ref-bibliography|. For a detailed introduction to programming in Lua, see
Roberto's book, Programming in Lua.
Lua means "moon" in Portuguese and is pronounced LOO-ah.
==============================================================================
2 THE LANGUAGE *lua-language*
This section describes the lexis, the syntax, and the semantics of Lua. In
other words, this section describes which tokens are valid, how they can be
combined, and what their combinations mean.
The language constructs will be explained using the usual extended BNF
notation, in which `{ a }` means 0 or more `a`'s, and `[ a ]` means an optional `a`.
==============================================================================
2.1 Lexical Conventions *lua-lexical*
*lua-names* *lua-identifiers*
Names (also called identifiers) in Lua can be any string of letters, digits,
and underscores, not beginning with a digit. This coincides with the
definition of identifiers in most languages. (The definition of letter depends
on the current locale: any character considered alphabetic by the current
locale can be used in an identifier.) Identifiers are used to name variables
and table fields.
The following keywords are reserved and cannot be used as names:
>
and break do else elseif
end false for function if
in local nil not or
repeat return then true until while
<
Lua is a case-sensitive language: `and` is a reserved word, but `And` and `AND` are
two different, valid names. As a convention, names starting with an underscore
followed by uppercase letters (such as `_VERSION`) are reserved for