commit
74f8cd15bb
102 changed files with 28521 additions and 0 deletions
@ -0,0 +1,32 @@
|
||||
Lua License |
||||
----------- |
||||
|
||||
Lua is licensed under the terms of the MIT license reproduced below. |
||||
This means that Lua is free software and can be used for both academic |
||||
and commercial purposes at absolutely no cost. |
||||
|
||||
For details and rationale, see http://www.lua.org/license.html . |
||||
|
||||
=============================================================================== |
||||
|
||||
Copyright (C) 1994-2012 Lua.org, PUC-Rio. |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in |
||||
all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
||||
|
||||
=============================================================================== |
@ -0,0 +1,183 @@
|
||||
HISTORY for Lua 5.1 |
||||
|
||||
* Changes from version 5.0 to 5.1 |
||||
------------------------------- |
||||
Language: |
||||
+ new module system. |
||||
+ new semantics for control variables of fors. |
||||
+ new semantics for setn/getn. |
||||
+ new syntax/semantics for varargs. |
||||
+ new long strings and comments. |
||||
+ new `mod' operator (`%') |
||||
+ new length operator #t |
||||
+ metatables for all types |
||||
API: |
||||
+ new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. |
||||
+ user supplies memory allocator (lua_open becomes lua_newstate). |
||||
+ luaopen_* functions must be called through Lua. |
||||
Implementation: |
||||
+ new configuration scheme via luaconf.h. |
||||
+ incremental garbage collection. |
||||
+ better handling of end-of-line in the lexer. |
||||
+ fully reentrant parser (new Lua function `load') |
||||
+ better support for 64-bit machines. |
||||
+ native loadlib support for Mac OS X. |
||||
+ standard distribution in only one library (lualib.a merged into lua.a) |
||||
|
||||
* Changes from version 4.0 to 5.0 |
||||
------------------------------- |
||||
Language: |
||||
+ lexical scoping. |
||||
+ Lua coroutines. |
||||
+ standard libraries now packaged in tables. |
||||
+ tags replaced by metatables and tag methods replaced by metamethods, |
||||
stored in metatables. |
||||
+ proper tail calls. |
||||
+ each function can have its own global table, which can be shared. |
||||
+ new __newindex metamethod, called when we insert a new key into a table. |
||||
+ new block comments: --[[ ... ]]. |
||||
+ new generic for. |
||||
+ new weak tables. |
||||
+ new boolean type. |
||||
+ new syntax "local function". |
||||
+ (f()) returns the first value returned by f. |
||||
+ {f()} fills a table with all values returned by f. |
||||
+ \n ignored in [[\n . |
||||
+ fixed and-or priorities. |
||||
+ more general syntax for function definition (e.g. function a.x.y:f()...end). |
||||
+ more general syntax for function calls (e.g. (print or write)(9)). |
||||
+ new functions (time/date, tmpfile, unpack, require, load*, etc.). |
||||
API: |
||||
+ chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer. |
||||
+ introduced lightweight userdata, a simple "void*" without a metatable. |
||||
+ new error handling protocol: the core no longer prints error messages; |
||||
all errors are reported to the caller on the stack. |
||||
+ new lua_atpanic for host cleanup. |
||||
+ new, signal-safe, hook scheme. |
||||
Implementation: |
||||
+ new license: MIT. |
||||
+ new, faster, register-based virtual machine. |
||||
+ support for external multithreading and coroutines. |
||||
+ new and consistent error message format. |
||||
+ the core no longer needs "stdio.h" for anything (except for a single |
||||
use of sprintf to convert numbers to strings). |
||||
+ lua.c now runs the environment variable LUA_INIT, if present. It can |
||||
be "@filename", to run a file, or the chunk itself. |
||||
+ support for user extensions in lua.c. |
||||
sample implementation given for command line editing. |
||||
+ new dynamic loading library, active by default on several platforms. |
||||
+ safe garbage-collector metamethods. |
||||
+ precompiled bytecodes checked for integrity (secure binary dostring). |
||||
+ strings are fully aligned. |
||||
+ position capture in string.find. |
||||
+ read('*l') can read lines with embedded zeros. |
||||
|
||||
* Changes from version 3.2 to 4.0 |
||||
------------------------------- |
||||
Language: |
||||
+ new "break" and "for" statements (both numerical and for tables). |
||||
+ uniform treatment of globals: globals are now stored in a Lua table. |
||||
+ improved error messages. |
||||
+ no more '$debug': full speed *and* full debug information. |
||||
+ new read form: read(N) for next N bytes. |
||||
+ general read patterns now deprecated. |
||||
(still available with -DCOMPAT_READPATTERNS.) |
||||
+ all return values are passed as arguments for the last function |
||||
(old semantics still available with -DLUA_COMPAT_ARGRET) |
||||
+ garbage collection tag methods for tables now deprecated. |
||||
+ there is now only one tag method for order. |
||||
API: |
||||
+ New API: fully re-entrant, simpler, and more efficient. |
||||
+ New debug API. |
||||
Implementation: |
||||
+ faster than ever: cleaner virtual machine and new hashing algorithm. |
||||
+ non-recursive garbage-collector algorithm. |
||||
+ reduced memory usage for programs with many strings. |
||||
+ improved treatment for memory allocation errors. |
||||
+ improved support for 16-bit machines (we hope). |
||||
+ code now compiles unmodified as both ANSI C and C++. |
||||
+ numbers in bases other than 10 are converted using strtoul. |
||||
+ new -f option in Lua to support #! scripts. |
||||
+ luac can now combine text and binaries. |
||||
|
||||
* Changes from version 3.1 to 3.2 |
||||
------------------------------- |
||||
+ redirected all output in Lua's core to _ERRORMESSAGE and _ALERT. |
||||
+ increased limit on the number of constants and globals per function |
||||
(from 2^16 to 2^24). |
||||
+ debugging info (lua_debug and hooks) moved into lua_state and new API |
||||
functions provided to get and set this info. |
||||
+ new debug lib gives full debugging access within Lua. |
||||
+ new table functions "foreachi", "sort", "tinsert", "tremove", "getn". |
||||
+ new io functions "flush", "seek". |
||||
|
||||
* Changes from version 3.0 to 3.1 |
||||
------------------------------- |
||||
+ NEW FEATURE: anonymous functions with closures (via "upvalues"). |
||||
+ new syntax: |
||||
- local variables in chunks. |
||||
- better scope control with DO block END. |
||||
- constructors can now be also written: { record-part; list-part }. |
||||
- more general syntax for function calls and lvalues, e.g.: |
||||
f(x).y=1 |
||||
o:f(x,y):g(z) |
||||
f"string" is sugar for f("string") |
||||
+ strings may now contain arbitrary binary data (e.g., embedded zeros). |
||||
+ major code re-organization and clean-up; reduced module interdependecies. |
||||
+ no arbitrary limits on the total number of constants and globals. |
||||
+ support for multiple global contexts. |
||||
+ better syntax error messages. |
||||
+ new traversal functions "foreach" and "foreachvar". |
||||
+ the default for numbers is now double. |
||||
changing it to use floats or longs is easy. |
||||
+ complete debug information stored in pre-compiled chunks. |
||||
+ sample interpreter now prompts user when run interactively, and also |
||||
handles control-C interruptions gracefully. |
||||
|
||||
* Changes from version 2.5 to 3.0 |
||||
------------------------------- |
||||
+ NEW CONCEPT: "tag methods". |
||||
Tag methods replace fallbacks as the meta-mechanism for extending the |
||||
semantics of Lua. Whereas fallbacks had a global nature, tag methods |
||||
work on objects having the same tag (e.g., groups of tables). |
||||
Existing code that uses fallbacks should work without change. |
||||
+ new, general syntax for constructors {[exp] = exp, ... }. |
||||
+ support for handling variable number of arguments in functions (varargs). |
||||
+ support for conditional compilation ($if ... $else ... $end). |
||||
+ cleaner semantics in API simplifies host code. |
||||
+ better support for writing libraries (auxlib.h). |
||||
+ better type checking and error messages in the standard library. |
||||
+ luac can now also undump. |
||||
|
||||
* Changes from version 2.4 to 2.5 |
||||
------------------------------- |
||||
+ io and string libraries are now based on pattern matching; |
||||
the old libraries are still available for compatibility |
||||
+ dofile and dostring can now return values (via return statement) |
||||
+ better support for 16- and 64-bit machines |
||||
+ expanded documentation, with more examples |
||||
|
||||
* Changes from version 2.2 to 2.4 |
||||
------------------------------- |
||||
+ external compiler creates portable binary files that can be loaded faster |
||||
+ interface for debugging and profiling |
||||
+ new "getglobal" fallback |
||||
+ new functions for handling references to Lua objects |
||||
+ new functions in standard lib |
||||
+ only one copy of each string is stored |
||||
+ expanded documentation, with more examples |
||||
|
||||
* Changes from version 2.1 to 2.2 |
||||
------------------------------- |
||||
+ functions now may be declared with any "lvalue" as a name |
||||
+ garbage collection of functions |
||||
+ support for pipes |
||||
|
||||
* Changes from version 1.1 to 2.1 |
||||
------------------------------- |
||||
+ object-oriented support |
||||
+ fallbacks |
||||
+ simplified syntax for tables |
||||
+ many internal improvements |
||||
|
||||
(end of HISTORY) |
@ -0,0 +1,99 @@
|
||||
INSTALL for Lua 5.1 |
||||
|
||||
* Building Lua |
||||
------------ |
||||
Lua is built in the src directory, but the build process can be |
||||
controlled from the top-level Makefile. |
||||
|
||||
Building Lua on Unix systems should be very easy. First do "make" and |
||||
see if your platform is listed. If so, just do "make xxx", where xxx |
||||
is your platform name. The platforms currently supported are: |
||||
aix ansi bsd freebsd generic linux macosx mingw posix solaris |
||||
|
||||
If your platform is not listed, try the closest one or posix, generic, |
||||
ansi, in this order. |
||||
|
||||
See below for customization instructions and for instructions on how |
||||
to build with other Windows compilers. |
||||
|
||||
If you want to check that Lua has been built correctly, do "make test" |
||||
after building Lua. Also, have a look at the example programs in test. |
||||
|
||||
* Installing Lua |
||||
-------------- |
||||
Once you have built Lua, you may want to install it in an official |
||||
place in your system. In this case, do "make install". The official |
||||
place and the way to install files are defined in Makefile. You must |
||||
have the right permissions to install files. |
||||
|
||||
If you want to build and install Lua in one step, do "make xxx install", |
||||
where xxx is your platform name. |
||||
|
||||
If you want to install Lua locally, then do "make local". This will |
||||
create directories bin, include, lib, man, and install Lua there as |
||||
follows: |
||||
|
||||
bin: lua luac |
||||
include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp |
||||
lib: liblua.a |
||||
man/man1: lua.1 luac.1 |
||||
|
||||
These are the only directories you need for development. |
||||
|
||||
There are man pages for lua and luac, in both nroff and html, and a |
||||
reference manual in html in doc, some sample code in test, and some |
||||
useful stuff in etc. You don't need these directories for development. |
||||
|
||||
If you want to install Lua locally, but in some other directory, do |
||||
"make install INSTALL_TOP=xxx", where xxx is your chosen directory. |
||||
|
||||
See below for instructions for Windows and other systems. |
||||
|
||||
* Customization |
||||
------------- |
||||
Three things can be customized by editing a file: |
||||
- Where and how to install Lua -- edit Makefile. |
||||
- How to build Lua -- edit src/Makefile. |
||||
- Lua features -- edit src/luaconf.h. |
||||
|
||||
You don't actually need to edit the Makefiles because you may set the |
||||
relevant variables when invoking make. |
||||
|
||||
On the other hand, if you need to select some Lua features, you'll need |
||||
to edit src/luaconf.h. The edited file will be the one installed, and |
||||
it will be used by any Lua clients that you build, to ensure consistency. |
||||
|
||||
We strongly recommend that you enable dynamic loading. This is done |
||||
automatically for all platforms listed above that have this feature |
||||
(and also Windows). See src/luaconf.h and also src/Makefile. |
||||
|
||||
* Building Lua on Windows and other systems |
||||
----------------------------------------- |
||||
If you're not using the usual Unix tools, then the instructions for |
||||
building Lua depend on the compiler you use. You'll need to create |
||||
projects (or whatever your compiler uses) for building the library, |
||||
the interpreter, and the compiler, as follows: |
||||
|
||||
library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c |
||||
lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c |
||||
ltable.c ltm.c lundump.c lvm.c lzio.c |
||||
lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c |
||||
ltablib.c lstrlib.c loadlib.c linit.c |
||||
|
||||
interpreter: library, lua.c |
||||
|
||||
compiler: library, luac.c print.c |
||||
|
||||
If you use Visual Studio .NET, you can use etc/luavs.bat in its |
||||
"Command Prompt". |
||||
|
||||
If all you want is to build the Lua interpreter, you may put all .c files |
||||
in a single project, except for luac.c and print.c. Or just use etc/all.c. |
||||
|
||||
To use Lua as a library in your own programs, you'll need to know how to |
||||
create and use libraries with your compiler. |
||||
|
||||
As mentioned above, you may edit luaconf.h to select some features before |
||||
building Lua. |
||||
|
||||
(end of INSTALL) |
@ -0,0 +1,128 @@
|
||||
# makefile for installing Lua
|
||||
# see INSTALL for installation instructions
|
||||
# see src/Makefile and src/luaconf.h for further customization
|
||||
|
||||
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
|
||||
|
||||
# Your platform. See PLATS for possible values.
|
||||
PLAT= none
|
||||
|
||||
# Where to install. The installation starts in the src and doc directories,
|
||||
# so take care if INSTALL_TOP is not an absolute path.
|
||||
INSTALL_TOP= /usr/local
|
||||
INSTALL_BIN= $(INSTALL_TOP)/bin
|
||||
INSTALL_INC= $(INSTALL_TOP)/include
|
||||
INSTALL_LIB= $(INSTALL_TOP)/lib
|
||||
INSTALL_MAN= $(INSTALL_TOP)/man/man1
|
||||
#
|
||||
# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
|
||||
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
|
||||
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
|
||||
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
|
||||
|
||||
# How to install. If your install program does not support "-p", then you
|
||||
# may have to run ranlib on the installed liblua.a (do "make ranlib").
|
||||
INSTALL= install -p
|
||||
INSTALL_EXEC= $(INSTALL) -m 0755
|
||||
INSTALL_DATA= $(INSTALL) -m 0644
|
||||
#
|
||||
# If you don't have install you can use cp instead.
|
||||
# INSTALL= cp -p
|
||||
# INSTALL_EXEC= $(INSTALL)
|
||||
# INSTALL_DATA= $(INSTALL)
|
||||
|
||||
# Utilities.
|
||||
MKDIR= mkdir -p
|
||||
RANLIB= ranlib
|
||||
|
||||
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
|
||||
|
||||
# Convenience platforms targets.
|
||||
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
|
||||
|
||||
# What to install.
|
||||
TO_BIN= lua luac
|
||||
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
|
||||
TO_LIB= liblua.a
|
||||
TO_MAN= lua.1 luac.1
|
||||
|
||||
# Lua version and release.
|
||||
V= 5.1
|
||||
R= 5.1.5
|
||||
|
||||
all: $(PLAT) |
||||
|
||||
$(PLATS) clean: |
||||
cd src && $(MAKE) $@
|
||||
|
||||
test: dummy |
||||
src/lua test/hello.lua
|
||||
|
||||
install: dummy |
||||
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
|
||||
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
|
||||
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
|
||||
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
|
||||
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
|
||||
|
||||
ranlib: |
||||
cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
|
||||
|
||||
local: |
||||
$(MAKE) install INSTALL_TOP=..
|
||||
|
||||
none: |
||||
@echo "Please do"
|
||||
@echo " make PLATFORM"
|
||||
@echo "where PLATFORM is one of these:"
|
||||
@echo " $(PLATS)"
|
||||
@echo "See INSTALL for complete instructions."
|
||||
|
||||
# make may get confused with test/ and INSTALL in a case-insensitive OS
|
||||
dummy: |
||||
|
||||
# echo config parameters
|
||||
echo: |
||||
@echo ""
|
||||
@echo "These are the parameters currently set in src/Makefile to build Lua $R:"
|
||||
@echo ""
|
||||
@cd src && $(MAKE) -s echo
|
||||
@echo ""
|
||||
@echo "These are the parameters currently set in Makefile to install Lua $R:"
|
||||
@echo ""
|
||||
@echo "PLAT = $(PLAT)"
|
||||
@echo "INSTALL_TOP = $(INSTALL_TOP)"
|
||||
@echo "INSTALL_BIN = $(INSTALL_BIN)"
|
||||
@echo "INSTALL_INC = $(INSTALL_INC)"
|
||||
@echo "INSTALL_LIB = $(INSTALL_LIB)"
|
||||
@echo "INSTALL_MAN = $(INSTALL_MAN)"
|
||||
@echo "INSTALL_LMOD = $(INSTALL_LMOD)"
|
||||
@echo "INSTALL_CMOD = $(INSTALL_CMOD)"
|
||||
@echo "INSTALL_EXEC = $(INSTALL_EXEC)"
|
||||
@echo "INSTALL_DATA = $(INSTALL_DATA)"
|
||||
@echo ""
|
||||
@echo "See also src/luaconf.h ."
|
||||
@echo ""
|
||||
|
||||
# echo private config parameters
|
||||
pecho: |
||||
@echo "V = $(V)"
|
||||
@echo "R = $(R)"
|
||||
@echo "TO_BIN = $(TO_BIN)"
|
||||
@echo "TO_INC = $(TO_INC)"
|
||||
@echo "TO_LIB = $(TO_LIB)"
|
||||
@echo "TO_MAN = $(TO_MAN)"
|
||||
|
||||
# echo config parameters as Lua code
|
||||
# uncomment the last sed expression if you want nil instead of empty strings
|
||||
lecho: |
||||
@echo "-- installation parameters for Lua $R"
|
||||
@echo "VERSION = '$V'"
|
||||
@echo "RELEASE = '$R'"
|
||||
@$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/'
|
||||
@echo "-- EOF"
|
||||
|
||||
# list targets that do not create files (but not all makes understand .PHONY)
|
||||
.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho |
||||
|
||||
# (end of Makefile)
|
@ -0,0 +1,43 @@
|
||||
# Cataract - an environment for end-user programming in Lua 5.1 |
||||
|
||||
"Enable all people to modify the software they use in the course of using it." |
||||
-- https://futureofcoding.org/episodes/033.html |
||||
|
||||
"What if we, and all computer users, could reach in and modify our favorite apps?" |
||||
-- https://www.inkandswitch.com/end-user-programming |
||||
|
||||
"Software must be as easy to change as it is to use it" |
||||
-- https://malleable.systems |
||||
|
||||
# README for Lua 5.1 |
||||
|
||||
* What is Lua? |
||||
------------ |
||||
Lua is a powerful, light-weight programming language designed for extending |
||||
applications. Lua is also frequently used as a general-purpose, stand-alone |
||||
language. Lua is free software. |
||||
|
||||
For complete information, visit Lua's web site at http://www.lua.org/ . |
||||
For an executive summary, see http://www.lua.org/about.html . |
||||
|
||||
Lua has been used in many different projects around the world. |
||||
For a short list, see http://www.lua.org/uses.html . |
||||
|
||||
* Availability |
||||
------------ |
||||
Lua is freely available for both academic and commercial purposes. |
||||
See COPYRIGHT and http://www.lua.org/license.html for details. |
||||
Lua can be downloaded at http://www.lua.org/download.html . |
||||
|
||||
* Installation |
||||
------------ |
||||
Lua is implemented in pure ANSI C, and compiles unmodified in all known |
||||
platforms that have an ANSI C compiler. In most Unix-like platforms, simply |
||||
do "make" with a suitable target. See INSTALL for detailed instructions. |
||||
|
||||
* Origin |
||||
------ |
||||
Lua is developed at Lua.org, a laboratory of the Department of Computer |
||||
Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro |
||||
in Brazil). |
||||
For more information about the authors, see http://www.lua.org/authors.html . |
@ -0,0 +1,497 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
||||
<HTML> |
||||
<HEAD> |
||||
<TITLE>Lua 5.1 Reference Manual - contents</TITLE> |
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css"> |
||||
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> |
||||
<STYLE TYPE="text/css"> |
||||
ul { |
||||
list-style-type: none ; |
||||
} |
||||
</STYLE> |
||||
</HEAD> |
||||
|
||||
<BODY> |
||||
|
||||
<HR> |
||||
<H1> |
||||
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="" BORDER=0></A> |
||||
Lua 5.1 Reference Manual |
||||
</H1> |
||||
|
||||
<P> |
||||
The reference manual is the official definition of the Lua language. |
||||
For a complete introduction to Lua programming, see the book |
||||
<A HREF="http://www.lua.org/docs.html#pil">Programming in Lua</A>. |
||||
|
||||
<P> |
||||
This manual is also available as a book: |
||||
<BLOCKQUOTE> |
||||
<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20"> |
||||
<IMG SRC="cover.png" ALT="" TITLE="buy from Amazon" BORDER=1 ALIGN="left" HSPACE=12> |
||||
</A> |
||||
<B>Lua 5.1 Reference Manual</B> |
||||
<BR>by R. Ierusalimschy, L. H. de Figueiredo, W. Celes |
||||
<BR>Lua.org, August 2006 |
||||
<BR>ISBN 85-903798-3-3 |
||||
<BR CLEAR="all"> |
||||
</BLOCKQUOTE> |
||||
|
||||
<P> |
||||
<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">Buy a copy</A> |
||||
of this book and |
||||
<A HREF="http://www.lua.org/donations.html">help to support</A> |
||||
the Lua project. |
||||
|
||||
<P> |
||||
<A HREF="manual.html">start</A> |
||||
· |
||||
<A HREF="#contents">contents</A> |
||||
· |
||||
<A HREF="#index">index</A> |
||||
· |
||||
<A HREF="http://www.lua.org/manual/">other versions</A> |
||||
<HR> |
||||
<SMALL> |
||||
Copyright © 2006–2012 Lua.org, PUC-Rio. |
||||
Freely available under the terms of the |
||||
<A HREF="http://www.lua.org/license.html">Lua license</A>. |
||||
</SMALL> |
||||
|
||||
<H2><A NAME="contents">Contents</A></H2> |
||||
<UL style="padding: 0"> |
||||
<LI><A HREF="manual.html">1 – Introduction</A> |
||||
<P> |
||||
<LI><A HREF="manual.html#2">2 – The Language</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#2.1">2.1 – Lexical Conventions</A> |
||||
<LI><A HREF="manual.html#2.2">2.2 – Values and Types</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#2.2.1">2.2.1 – Coercion</A> |
||||
</UL> |
||||
<LI><A HREF="manual.html#2.3">2.3 – Variables</A> |
||||
<LI><A HREF="manual.html#2.4">2.4 – Statements</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#2.4.1">2.4.1 – Chunks</A> |
||||
<LI><A HREF="manual.html#2.4.2">2.4.2 – Blocks</A> |
||||
<LI><A HREF="manual.html#2.4.3">2.4.3 – Assignment</A> |
||||
<LI><A HREF="manual.html#2.4.4">2.4.4 – Control Structures</A> |
||||
<LI><A HREF="manual.html#2.4.5">2.4.5 – For Statement</A> |
||||
<LI><A HREF="manual.html#2.4.6">2.4.6 – Function Calls as Statements</A> |
||||
<LI><A HREF="manual.html#2.4.7">2.4.7 – Local Declarations</A> |
||||
</UL> |
||||
<LI><A HREF="manual.html#2.5">2.5 – Expressions</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#2.5.1">2.5.1 – Arithmetic Operators</A> |
||||
<LI><A HREF="manual.html#2.5.2">2.5.2 – Relational Operators</A> |
||||
<LI><A HREF="manual.html#2.5.3">2.5.3 – Logical Operators</A> |
||||
<LI><A HREF="manual.html#2.5.4">2.5.4 – Concatenation</A> |
||||
<LI><A HREF="manual.html#2.5.5">2.5.5 – The Length Operator</A> |
||||
<LI><A HREF="manual.html#2.5.6">2.5.6 – Precedence</A> |
||||
<LI><A HREF="manual.html#2.5.7">2.5.7 – Table Constructors</A> |
||||
<LI><A HREF="manual.html#2.5.8">2.5.8 – Function Calls</A> |
||||
<LI><A HREF="manual.html#2.5.9">2.5.9 – Function Definitions</A> |
||||
</UL> |
||||
<LI><A HREF="manual.html#2.6">2.6 – Visibility Rules</A> |
||||
<LI><A HREF="manual.html#2.7">2.7 – Error Handling</A> |
||||
<LI><A HREF="manual.html#2.8">2.8 – Metatables</A> |
||||
<LI><A HREF="manual.html#2.9">2.9 – Environments</A> |
||||
<LI><A HREF="manual.html#2.10">2.10 – Garbage Collection</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#2.10.1">2.10.1 – Garbage-Collection Metamethods</A> |
||||
<LI><A HREF="manual.html#2.10.2">2.10.2 – Weak Tables</A> |
||||
</UL> |
||||
<LI><A HREF="manual.html#2.11">2.11 – Coroutines</A> |
||||
</UL> |
||||
<P> |
||||
<LI><A HREF="manual.html#3">3 – The Application Program Interface</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#3.1">3.1 – The Stack</A> |
||||
<LI><A HREF="manual.html#3.2">3.2 – Stack Size</A> |
||||
<LI><A HREF="manual.html#3.3">3.3 – Pseudo-Indices</A> |
||||
<LI><A HREF="manual.html#3.4">3.4 – C Closures</A> |
||||
<LI><A HREF="manual.html#3.5">3.5 – Registry</A> |
||||
<LI><A HREF="manual.html#3.6">3.6 – Error Handling in C</A> |
||||
<LI><A HREF="manual.html#3.7">3.7 – Functions and Types</A> |
||||
<LI><A HREF="manual.html#3.8">3.8 – The Debug Interface</A> |
||||
</UL> |
||||
<P> |
||||
<LI><A HREF="manual.html#4">4 – The Auxiliary Library</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#4.1">4.1 – Functions and Types</A> |
||||
</UL> |
||||
<P> |
||||
<LI><A HREF="manual.html#5">5 – Standard Libraries</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#5.1">5.1 – Basic Functions</A> |
||||
<LI><A HREF="manual.html#5.2">5.2 – Coroutine Manipulation</A> |
||||
<LI><A HREF="manual.html#5.3">5.3 – Modules</A> |
||||
<LI><A HREF="manual.html#5.4">5.4 – String Manipulation</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#5.4.1">5.4.1 – Patterns</A> |
||||
</UL> |
||||
<LI><A HREF="manual.html#5.5">5.5 – Table Manipulation</A> |
||||
<LI><A HREF="manual.html#5.6">5.6 – Mathematical Functions</A> |
||||
<LI><A HREF="manual.html#5.7">5.7 – Input and Output Facilities</A> |
||||
<LI><A HREF="manual.html#5.8">5.8 – Operating System Facilities</A> |
||||
<LI><A HREF="manual.html#5.9">5.9 – The Debug Library</A> |
||||
</UL> |
||||
<P> |
||||
<LI><A HREF="manual.html#6">6 – Lua Stand-alone</A> |
||||
<P> |
||||
<LI><A HREF="manual.html#7">7 – Incompatibilities with the Previous Version</A> |
||||
<UL> |
||||
<LI><A HREF="manual.html#7.1">7.1 – Changes in the Language</A> |
||||
<LI><A HREF="manual.html#7.2">7.2 – Changes in the Libraries</A> |
||||
<LI><A HREF="manual.html#7.3">7.3 – Changes in the API</A> |
||||
</UL> |
||||
<P> |
||||
<LI><A HREF="manual.html#8">8 – The Complete Syntax of Lua</A> |
||||
</UL> |
||||
|
||||
<H2><A NAME="index">Index</A></H2> |
||||
<TABLE WIDTH="100%"> |
||||
<TR VALIGN="top"> |
||||
<TD> |
||||
<H3><A NAME="functions">Lua functions</A></H3> |
||||
<A HREF="manual.html#pdf-_G">_G</A><BR> |
||||
<A HREF="manual.html#pdf-_VERSION">_VERSION</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-assert">assert</A><BR> |
||||
<A HREF="manual.html#pdf-collectgarbage">collectgarbage</A><BR> |
||||
<A HREF="manual.html#pdf-dofile">dofile</A><BR> |
||||
<A HREF="manual.html#pdf-error">error</A><BR> |
||||
<A HREF="manual.html#pdf-getfenv">getfenv</A><BR> |
||||
<A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR> |
||||
<A HREF="manual.html#pdf-ipairs">ipairs</A><BR> |
||||
<A HREF="manual.html#pdf-load">load</A><BR> |
||||
<A HREF="manual.html#pdf-loadfile">loadfile</A><BR> |
||||
<A HREF="manual.html#pdf-loadstring">loadstring</A><BR> |
||||
<A HREF="manual.html#pdf-module">module</A><BR> |
||||
<A HREF="manual.html#pdf-next">next</A><BR> |
||||
<A HREF="manual.html#pdf-pairs">pairs</A><BR> |
||||
<A HREF="manual.html#pdf-pcall">pcall</A><BR> |
||||
<A HREF="manual.html#pdf-print">print</A><BR> |
||||
<A HREF="manual.html#pdf-rawequal">rawequal</A><BR> |
||||
<A HREF="manual.html#pdf-rawget">rawget</A><BR> |
||||
<A HREF="manual.html#pdf-rawset">rawset</A><BR> |
||||
<A HREF="manual.html#pdf-require">require</A><BR> |
||||
<A HREF="manual.html#pdf-select">select</A><BR> |
||||
<A HREF="manual.html#pdf-setfenv">setfenv</A><BR> |
||||
<A HREF="manual.html#pdf-setmetatable">setmetatable</A><BR> |
||||
<A HREF="manual.html#pdf-tonumber">tonumber</A><BR> |
||||
<A HREF="manual.html#pdf-tostring">tostring</A><BR> |
||||
<A HREF="manual.html#pdf-type">type</A><BR> |
||||
<A HREF="manual.html#pdf-unpack">unpack</A><BR> |
||||
<A HREF="manual.html#pdf-xpcall">xpcall</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR> |
||||
<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR> |
||||
<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR> |
||||
<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR> |
||||
<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR> |
||||
<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR> |
||||
<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR> |
||||
<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR> |
||||
<A HREF="manual.html#pdf-debug.getinfo">debug.getinfo</A><BR> |
||||
<A HREF="manual.html#pdf-debug.getlocal">debug.getlocal</A><BR> |
||||
<A HREF="manual.html#pdf-debug.getmetatable">debug.getmetatable</A><BR> |
||||
<A HREF="manual.html#pdf-debug.getregistry">debug.getregistry</A><BR> |
||||
<A HREF="manual.html#pdf-debug.getupvalue">debug.getupvalue</A><BR> |
||||
<A HREF="manual.html#pdf-debug.setfenv">debug.setfenv</A><BR> |
||||
<A HREF="manual.html#pdf-debug.sethook">debug.sethook</A><BR> |
||||
<A HREF="manual.html#pdf-debug.setlocal">debug.setlocal</A><BR> |
||||
<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR> |
||||
<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR> |
||||
<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR> |
||||
|
||||
</TD> |
||||
<TD> |
||||
<H3> </H3> |
||||
<A HREF="manual.html#pdf-file:close">file:close</A><BR> |
||||
<A HREF="manual.html#pdf-file:flush">file:flush</A><BR> |
||||
<A HREF="manual.html#pdf-file:lines">file:lines</A><BR> |
||||
<A HREF="manual.html#pdf-file:read">file:read</A><BR> |
||||
<A HREF="manual.html#pdf-file:seek">file:seek</A><BR> |
||||
<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR> |
||||
<A HREF="manual.html#pdf-file:write">file:write</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-io.close">io.close</A><BR> |
||||
<A HREF="manual.html#pdf-io.flush">io.flush</A><BR> |
||||
<A HREF="manual.html#pdf-io.input">io.input</A><BR> |
||||
<A HREF="manual.html#pdf-io.lines">io.lines</A><BR> |
||||
<A HREF="manual.html#pdf-io.open">io.open</A><BR> |
||||
<A HREF="manual.html#pdf-io.output">io.output</A><BR> |
||||
<A HREF="manual.html#pdf-io.popen">io.popen</A><BR> |
||||
<A HREF="manual.html#pdf-io.read">io.read</A><BR> |
||||
<A HREF="manual.html#pdf-io.stderr">io.stderr</A><BR> |
||||
<A HREF="manual.html#pdf-io.stdin">io.stdin</A><BR> |
||||
<A HREF="manual.html#pdf-io.stdout">io.stdout</A><BR> |
||||
<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR> |
||||
<A HREF="manual.html#pdf-io.type">io.type</A><BR> |
||||
<A HREF="manual.html#pdf-io.write">io.write</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-math.abs">math.abs</A><BR> |
||||
<A HREF="manual.html#pdf-math.acos">math.acos</A><BR> |
||||
<A HREF="manual.html#pdf-math.asin">math.asin</A><BR> |
||||
<A HREF="manual.html#pdf-math.atan">math.atan</A><BR> |
||||
<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR> |
||||
<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR> |
||||
<A HREF="manual.html#pdf-math.cos">math.cos</A><BR> |
||||
<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR> |
||||
<A HREF="manual.html#pdf-math.deg">math.deg</A><BR> |
||||
<A HREF="manual.html#pdf-math.exp">math.exp</A><BR> |
||||
<A HREF="manual.html#pdf-math.floor">math.floor</A><BR> |
||||
<A HREF="manual.html#pdf-math.fmod">math.fmod</A><BR> |
||||
<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR> |
||||
<A HREF="manual.html#pdf-math.huge">math.huge</A><BR> |
||||
<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR> |
||||
<A HREF="manual.html#pdf-math.log">math.log</A><BR> |
||||
<A HREF="manual.html#pdf-math.log10">math.log10</A><BR> |
||||
<A HREF="manual.html#pdf-math.max">math.max</A><BR> |
||||
<A HREF="manual.html#pdf-math.min">math.min</A><BR> |
||||
<A HREF="manual.html#pdf-math.modf">math.modf</A><BR> |
||||
<A HREF="manual.html#pdf-math.pi">math.pi</A><BR> |
||||
<A HREF="manual.html#pdf-math.pow">math.pow</A><BR> |
||||
<A HREF="manual.html#pdf-math.rad">math.rad</A><BR> |
||||
<A HREF="manual.html#pdf-math.random">math.random</A><BR> |
||||
<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR> |
||||
<A HREF="manual.html#pdf-math.sin">math.sin</A><BR> |
||||
<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR> |
||||
<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR> |
||||
<A HREF="manual.html#pdf-math.tan">math.tan</A><BR> |
||||
<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-os.clock">os.clock</A><BR> |
||||
<A HREF="manual.html#pdf-os.date">os.date</A><BR> |
||||
<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR> |
||||
<A HREF="manual.html#pdf-os.execute">os.execute</A><BR> |
||||
<A HREF="manual.html#pdf-os.exit">os.exit</A><BR> |
||||
<A HREF="manual.html#pdf-os.getenv">os.getenv</A><BR> |
||||
<A HREF="manual.html#pdf-os.remove">os.remove</A><BR> |
||||
<A HREF="manual.html#pdf-os.rename">os.rename</A><BR> |
||||
<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR> |
||||
<A HREF="manual.html#pdf-os.time">os.time</A><BR> |
||||
<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR> |
||||
<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR> |
||||
<A HREF="manual.html#pdf-package.loaders">package.loaders</A><BR> |
||||
<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR> |
||||
<A HREF="manual.html#pdf-package.path">package.path</A><BR> |
||||
<A HREF="manual.html#pdf-package.preload">package.preload</A><BR> |
||||
<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-string.byte">string.byte</A><BR> |
||||
<A HREF="manual.html#pdf-string.char">string.char</A><BR> |
||||
<A HREF="manual.html#pdf-string.dump">string.dump</A><BR> |
||||
<A HREF="manual.html#pdf-string.find">string.find</A><BR> |
||||
<A HREF="manual.html#pdf-string.format">string.format</A><BR> |
||||
<A HREF="manual.html#pdf-string.gmatch">string.gmatch</A><BR> |
||||
<A HREF="manual.html#pdf-string.gsub">string.gsub</A><BR> |
||||
<A HREF="manual.html#pdf-string.len">string.len</A><BR> |
||||
<A HREF="manual.html#pdf-string.lower">string.lower</A><BR> |
||||
<A HREF="manual.html#pdf-string.match">string.match</A><BR> |
||||
<A HREF="manual.html#pdf-string.rep">string.rep</A><BR> |
||||
<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR> |
||||
<A HREF="manual.html#pdf-string.sub">string.sub</A><BR> |
||||
<A HREF="manual.html#pdf-string.upper">string.upper</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#pdf-table.concat">table.concat</A><BR> |
||||
<A HREF="manual.html#pdf-table.insert">table.insert</A><BR> |
||||
<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR> |
||||
<A HREF="manual.html#pdf-table.remove">table.remove</A><BR> |
||||
<A HREF="manual.html#pdf-table.sort">table.sort</A><BR> |
||||
|
||||
</TD> |
||||
<TD> |
||||
<H3>C API</H3> |
||||
<A HREF="manual.html#lua_Alloc">lua_Alloc</A><BR> |
||||
<A HREF="manual.html#lua_CFunction">lua_CFunction</A><BR> |
||||
<A HREF="manual.html#lua_Debug">lua_Debug</A><BR> |
||||
<A HREF="manual.html#lua_Hook">lua_Hook</A><BR> |
||||
<A HREF="manual.html#lua_Integer">lua_Integer</A><BR> |
||||
<A HREF="manual.html#lua_Number">lua_Number</A><BR> |
||||
<A HREF="manual.html#lua_Reader">lua_Reader</A><BR> |
||||
<A HREF="manual.html#lua_State">lua_State</A><BR> |
||||
<A HREF="manual.html#lua_Writer">lua_Writer</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR> |
||||
<A HREF="manual.html#lua_call">lua_call</A><BR> |
||||
<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR> |
||||
<A HREF="manual.html#lua_close">lua_close</A><BR> |
||||
<A HREF="manual.html#lua_concat">lua_concat</A><BR> |
||||
<A HREF="manual.html#lua_cpcall">lua_cpcall</A><BR> |
||||
<A HREF="manual.html#lua_createtable">lua_createtable</A><BR> |
||||
<A HREF="manual.html#lua_dump">lua_dump</A><BR> |
||||
<A HREF="manual.html#lua_equal">lua_equal</A><BR> |
||||
<A HREF="manual.html#lua_error">lua_error</A><BR> |
||||
<A HREF="manual.html#lua_gc">lua_gc</A><BR> |
||||
<A HREF="manual.html#lua_getallocf">lua_getallocf</A><BR> |
||||
<A HREF="manual.html#lua_getfenv">lua_getfenv</A><BR> |
||||
<A HREF="manual.html#lua_getfield">lua_getfield</A><BR> |
||||
<A HREF="manual.html#lua_getglobal">lua_getglobal</A><BR> |
||||
<A HREF="manual.html#lua_gethook">lua_gethook</A><BR> |
||||
<A HREF="manual.html#lua_gethookcount">lua_gethookcount</A><BR> |
||||
<A HREF="manual.html#lua_gethookmask">lua_gethookmask</A><BR> |
||||
<A HREF="manual.html#lua_getinfo">lua_getinfo</A><BR> |
||||
<A HREF="manual.html#lua_getlocal">lua_getlocal</A><BR> |
||||
<A HREF="manual.html#lua_getmetatable">lua_getmetatable</A><BR> |
||||
<A HREF="manual.html#lua_getstack">lua_getstack</A><BR> |
||||
<A HREF="manual.html#lua_gettable">lua_gettable</A><BR> |
||||
<A HREF="manual.html#lua_gettop">lua_gettop</A><BR> |
||||
<A HREF="manual.html#lua_getupvalue">lua_getupvalue</A><BR> |
||||
<A HREF="manual.html#lua_insert">lua_insert</A><BR> |
||||
<A HREF="manual.html#lua_isboolean">lua_isboolean</A><BR> |
||||
<A HREF="manual.html#lua_iscfunction">lua_iscfunction</A><BR> |
||||
<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR> |
||||
<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR> |
||||
<A HREF="manual.html#lua_isnil">lua_isnil</A><BR> |
||||
<A HREF="manual.html#lua_isnone">lua_isnone</A><BR> |
||||
<A HREF="manual.html#lua_isnoneornil">lua_isnoneornil</A><BR> |
||||
<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR> |
||||
<A HREF="manual.html#lua_isstring">lua_isstring</A><BR> |
||||
<A HREF="manual.html#lua_istable">lua_istable</A><BR> |
||||
<A HREF="manual.html#lua_isthread">lua_isthread</A><BR> |
||||
<A HREF="manual.html#lua_isuserdata">lua_isuserdata</A><BR> |
||||
<A HREF="manual.html#lua_lessthan">lua_lessthan</A><BR> |
||||
<A HREF="manual.html#lua_load">lua_load</A><BR> |
||||
<A HREF="manual.html#lua_newstate">lua_newstate</A><BR> |
||||
<A HREF="manual.html#lua_newtable">lua_newtable</A><BR> |
||||
<A HREF="manual.html#lua_newthread">lua_newthread</A><BR> |
||||
<A HREF="manual.html#lua_newuserdata">lua_newuserdata</A><BR> |
||||
<A HREF="manual.html#lua_next">lua_next</A><BR> |
||||
<A HREF="manual.html#lua_objlen">lua_objlen</A><BR> |
||||
<A HREF="manual.html#lua_pcall">lua_pcall</A><BR> |
||||
<A HREF="manual.html#lua_pop">lua_pop</A><BR> |
||||
<A HREF="manual.html#lua_pushboolean">lua_pushboolean</A><BR> |
||||
<A HREF="manual.html#lua_pushcclosure">lua_pushcclosure</A><BR> |
||||
<A HREF="manual.html#lua_pushcfunction">lua_pushcfunction</A><BR> |
||||
<A HREF="manual.html#lua_pushfstring">lua_pushfstring</A><BR> |
||||
<A HREF="manual.html#lua_pushinteger">lua_pushinteger</A><BR> |
||||
<A HREF="manual.html#lua_pushlightuserdata">lua_pushlightuserdata</A><BR> |
||||
<A HREF="manual.html#lua_pushliteral">lua_pushliteral</A><BR> |
||||
<A HREF="manual.html#lua_pushlstring">lua_pushlstring</A><BR> |
||||
<A HREF="manual.html#lua_pushnil">lua_pushnil</A><BR> |
||||
<A HREF="manual.html#lua_pushnumber">lua_pushnumber</A><BR> |
||||
<A HREF="manual.html#lua_pushstring">lua_pushstring</A><BR> |
||||
<A HREF="manual.html#lua_pushthread">lua_pushthread</A><BR> |
||||
<A HREF="manual.html#lua_pushvalue">lua_pushvalue</A><BR> |
||||
<A HREF="manual.html#lua_pushvfstring">lua_pushvfstring</A><BR> |
||||
<A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR> |
||||
<A HREF="manual.html#lua_rawget">lua_rawget</A><BR> |
||||
<A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR> |
||||
<A HREF="manual.html#lua_rawset">lua_rawset</A><BR> |
||||
<A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR> |
||||
<A HREF="manual.html#lua_register">lua_register</A><BR> |
||||
<A HREF="manual.html#lua_remove">lua_remove</A><BR> |
||||
<A HREF="manual.html#lua_replace">lua_replace</A><BR> |
||||
<A HREF="manual.html#lua_resume">lua_resume</A><BR> |
||||
<A HREF="manual.html#lua_setallocf">lua_setallocf</A><BR> |
||||
<A HREF="manual.html#lua_setfenv">lua_setfenv</A><BR> |
||||
<A HREF="manual.html#lua_setfield">lua_setfield</A><BR> |
||||
<A HREF="manual.html#lua_setglobal">lua_setglobal</A><BR> |
||||
<A HREF="manual.html#lua_sethook">lua_sethook</A><BR> |
||||
<A HREF="manual.html#lua_setlocal">lua_setlocal</A><BR> |
||||
<A HREF="manual.html#lua_setmetatable">lua_setmetatable</A><BR> |
||||
<A HREF="manual.html#lua_settable">lua_settable</A><BR> |
||||
<A HREF="manual.html#lua_settop">lua_settop</A><BR> |
||||
<A HREF="manual.html#lua_setupvalue">lua_setupvalue</A><BR> |
||||
<A HREF="manual.html#lua_status">lua_status</A><BR> |
||||
<A HREF="manual.html#lua_toboolean">lua_toboolean</A><BR> |
||||
<A HREF="manual.html#lua_tocfunction">lua_tocfunction</A><BR> |
||||
<A HREF="manual.html#lua_tointeger">lua_tointeger</A><BR> |
||||
<A HREF="manual.html#lua_tolstring">lua_tolstring</A><BR> |
||||
<A HREF="manual.html#lua_tonumber">lua_tonumber</A><BR> |
||||
<A HREF="manual.html#lua_topointer">lua_topointer</A><BR> |
||||
<A HREF="manual.html#lua_tostring">lua_tostring</A><BR> |
||||
<A HREF="manual.html#lua_tothread">lua_tothread</A><BR> |
||||
<A HREF="manual.html#lua_touserdata">lua_touserdata</A><BR> |
||||
<A HREF="manual.html#lua_type">lua_type</A><BR> |
||||
<A HREF="manual.html#lua_typename">lua_typename</A><BR> |
||||
<A HREF="manual.html#lua_upvalueindex">lua_upvalueindex</A><BR> |
||||
<A HREF="manual.html#lua_xmove">lua_xmove</A><BR> |
||||
<A HREF="manual.html#lua_yield">lua_yield</A><BR> |
||||
|
||||
</TD> |
||||
<TD> |
||||
<H3>auxiliary library</H3> |
||||
<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR> |
||||
<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR> |
||||
<P> |
||||
|
||||
<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR> |
||||
<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR> |
||||
<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR> |
||||
<A HREF="manual.html#luaL_addstring">luaL_addstring</A><BR> |
||||
<A HREF="manual.html#luaL_addvalue">luaL_addvalue</A><BR> |
||||
<A HREF="manual.html#luaL_argcheck">luaL_argcheck</A><BR> |
||||
<A HREF="manual.html#luaL_argerror">luaL_argerror</A><BR> |
||||
<A HREF="manual.html#luaL_buffinit">luaL_buffinit</A><BR> |
||||
<A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR> |
||||
<A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR> |
||||
<A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR> |
||||
<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR> |
||||
<A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR> |
||||
<A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR> |
||||
<A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR> |
||||
<A HREF="manual.html#luaL_checkoption">luaL_checkoption</A><BR> |
||||
<A HREF="manual.html#luaL_checkstack">luaL_checkstack</A><BR> |
||||
<A HREF="manual.html#luaL_checkstring">luaL_checkstring</A><BR> |
||||
<A HREF="manual.html#luaL_checktype">luaL_checktype</A><BR> |
||||
<A HREF="manual.html#luaL_checkudata">luaL_checkudata</A><BR> |
||||
<A HREF="manual.html#luaL_dofile">luaL_dofile</A><BR> |
||||
<A HREF="manual.html#luaL_dostring">luaL_dostring</A><BR> |
||||
<A HREF="manual.html#luaL_error">luaL_error</A><BR> |
||||
<A HREF="manual.html#luaL_getmetafield">luaL_getmetafield</A><BR> |
||||
<A HREF="manual.html#luaL_getmetatable">luaL_getmetatable</A><BR> |
||||
<A HREF="manual.html#luaL_gsub">luaL_gsub</A><BR> |
||||
<A HREF="manual.html#luaL_loadbuffer">luaL_loadbuffer</A><BR> |
||||
<A HREF="manual.html#luaL_loadfile">luaL_loadfile</A><BR> |
||||
<A HREF="manual.html#luaL_loadstring">luaL_loadstring</A><BR> |
||||
<A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR> |
||||
<A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR> |
||||
<A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR> |
||||
<A HREF="manual.html#luaL_optint">luaL_optint</A><BR> |
||||
<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR> |
||||
<A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR> |
||||
<A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR> |
||||
<A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR> |
||||
<A HREF="manual.html#luaL_optstring">luaL_optstring</A><BR> |
||||
<A HREF="manual.html#luaL_prepbuffer">luaL_prepbuffer</A><BR> |
||||
<A HREF="manual.html#luaL_pushresult">luaL_pushresult</A><BR> |
||||
<A HREF="manual.html#luaL_ref">luaL_ref</A><BR> |
||||
<A HREF="manual.html#luaL_register">luaL_register</A><BR> |
||||
<A HREF="manual.html#luaL_typename">luaL_typename</A><BR> |
||||
<A HREF="manual.html#luaL_typerror">luaL_typerror</A><BR> |
||||
<A HREF="manual.html#luaL_unref">luaL_unref</A><BR> |
||||
<A HREF="manual.html#luaL_where">luaL_where</A><BR> |
||||
|
||||
</TD> |
||||
</TR> |
||||
</TABLE> |
||||
<P> |
||||
|
||||
<HR> |
||||
<SMALL CLASS="footer"> |
||||
Last update: |
||||
Mon Feb 13 18:53:32 BRST 2012 |
||||
</SMALL> |
||||
<!-- |
||||
Last change: revised for Lua 5.1.5 |
||||
--> |
||||
|
||||
</BODY> |
||||
</HTML> |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.1 KiB |
@ -0,0 +1,163 @@
|
||||
.\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ |
||||
.TH LUA 1 "$Date: 2006/01/06 16:03:34 $" |
||||
.SH NAME |
||||
lua \- Lua interpreter |
||||
.SH SYNOPSIS |
||||
.B lua |
||||
[ |
||||
.I options |
||||
] |
||||
[ |
||||
.I script |
||||
[ |
||||
.I args |
||||
] |
||||
] |
||||
.SH DESCRIPTION |
||||
.B lua |
||||
is the stand-alone Lua interpreter. |
||||
It loads and executes Lua programs, |
||||
either in textual source form or |
||||
in precompiled binary form. |
||||
(Precompiled binaries are output by |
||||
.BR luac , |
||||
the Lua compiler.) |
||||
.B lua |
||||
can be used as a batch interpreter and also interactively. |
||||
.LP |
||||
The given |
||||
.I options |
||||
(see below) |
||||
are executed and then |
||||
the Lua program in file |
||||
.I script |
||||
is loaded and executed. |
||||
The given |
||||
.I args |
||||
are available to |
||||
.I script |
||||
as strings in a global table named |
||||
.BR arg . |
||||
If these arguments contain spaces or other characters special to the shell, |
||||
then they should be quoted |
||||
(but note that the quotes will be removed by the shell). |
||||
The arguments in |
||||
.B arg |
||||
start at 0, |
||||
which contains the string |
||||
.RI ' script '. |
||||
The index of the last argument is stored in |
||||
.BR arg.n . |
||||
The arguments given in the command line before |
||||
.IR script , |
||||
including the name of the interpreter, |
||||
are available in negative indices in |
||||
.BR arg . |
||||
.LP |
||||
At the very start, |
||||
before even handling the command line, |
||||
.B lua |
||||
executes the contents of the environment variable |
||||
.BR LUA_INIT , |
||||
if it is defined. |
||||
If the value of |
||||
.B LUA_INIT |
||||
is of the form |
||||
.RI '@ filename ', |
||||
then |
||||
.I filename |
||||
is executed. |
||||
Otherwise, the string is assumed to be a Lua statement and is executed. |
||||
.LP |
||||
Options start with |
||||
.B '\-' |
||||
and are described below. |
||||
You can use |
||||
.B "'\--'" |
||||
to signal the end of options. |
||||
.LP |
||||
If no arguments are given, |
||||
then |
||||
.B "\-v \-i" |
||||
is assumed when the standard input is a terminal; |
||||
otherwise, |
||||
.B "\-" |
||||
is assumed. |
||||
.LP |
||||
In interactive mode, |
||||
.B lua |
||||
prompts the user, |
||||
reads lines from the standard input, |
||||
and executes them as they are read. |
||||
If a line does not contain a complete statement, |
||||
then a secondary prompt is displayed and |
||||
lines are read until a complete statement is formed or |
||||
a syntax error is found. |
||||
So, one way to interrupt the reading of an incomplete statement is |
||||
to force a syntax error: |
||||
adding a |
||||
.B ';' |
||||
in the middle of a statement is a sure way of forcing a syntax error |
||||
(except inside multiline strings and comments; these must be closed explicitly). |
||||
If a line starts with |
||||
.BR '=' , |
||||
then |
||||
.B lua |
||||
displays the values of all the expressions in the remainder of the |
||||
line. The expressions must be separated by commas. |
||||
The primary prompt is the value of the global variable |
||||
.BR _PROMPT , |
||||
if this value is a string; |
||||
otherwise, the default prompt is used. |
||||
Similarly, the secondary prompt is the value of the global variable |
||||
.BR _PROMPT2 . |
||||
So, |
||||
to change the prompts, |
||||
set the corresponding variable to a string of your choice. |
||||
You can do that after calling the interpreter |
||||
or on the command line |
||||
(but in this case you have to be careful with quotes |
||||
if the prompt string contains a space; otherwise you may confuse the shell.) |
||||
The default prompts are "> " and ">> ". |
||||
.SH OPTIONS |
||||
.TP |
||||
.B \- |
||||
load and execute the standard input as a file, |
||||
that is, |
||||
not interactively, |
||||
even when the standard input is a terminal. |
||||
.TP |
||||
.BI \-e " stat" |
||||
execute statement |
||||
.IR stat . |
||||
You need to quote |
||||
.I stat |
||||
if it contains spaces, quotes, |
||||
or other characters special to the shell. |
||||
.TP |
||||
.B \-i |
||||
enter interactive mode after |
||||
.I script |
||||
is executed. |
||||
.TP |
||||
.BI \-l " name" |
||||
call |
||||
.BI require(' name ') |
||||
before executing |
||||
.IR script . |
||||
Typically used to load libraries. |
||||
.TP |
||||
.B \-v |
||||
show version information. |
||||
.SH "SEE ALSO" |
||||
.BR luac (1) |
||||
.br |
||||
http://www.lua.org/ |
||||
.SH DIAGNOSTICS |
||||
Error messages should be self explanatory. |
||||
.SH AUTHORS |
||||
R. Ierusalimschy, |
||||
L. H. de Figueiredo, |
||||
and |
||||
W. Celes |
||||
.\" EOF |
@ -0,0 +1,83 @@
|
||||
body { |
||||
color: #000000 ; |
||||
background-color: #FFFFFF ; |
||||
font-family: Helvetica, Arial, sans-serif ; |
||||
text-align: justify ; |
||||
margin-right: 30px ; |
||||
margin-left: 30px ; |
||||
} |
||||
|
||||
h1, h2, h3, h4 { |
||||
font-family: Verdana, Geneva, sans-serif ; |
||||
font-weight: normal ; |
||||
font-style: italic ; |
||||
} |
||||
|
||||
h2 { |
||||
padding-top: 0.4em ; |
||||
padding-bottom: 0.4em ; |
||||
padding-left: 30px ; |
||||
padding-right: 30px ; |
||||
margin-left: -30px ; |
||||
background-color: #E0E0FF ; |
||||
} |
||||
|
||||
h3 { |
||||
padding-left: 0.5em ; |
||||
border-left: solid #E0E0FF 1em ; |
||||
} |
||||
|
||||
table h3 { |
||||
padding-left: 0px ; |
||||
border-left: none ; |
||||
} |
||||
|
||||
a:link { |
||||
color: #000080 ; |
||||
background-color: inherit ; |
||||
text-decoration: none ; |
||||
} |
||||
|
||||
a:visited { |
||||
background-color: inherit ; |
||||
text-decoration: none ; |
||||
} |
||||
|
||||
a:link:hover, a:visited:hover { |
||||
color: #000080 ; |
||||
background-color: #E0E0FF ; |
||||
} |
||||
|
||||
a:link:active, a:visited:active { |
||||
color: #FF0000 ; |
||||
} |
||||
|
||||
hr { |
||||
border: 0 ; |
||||
height: 1px ; |
||||
color: #a0a0a0 ; |
||||
background-color: #a0a0a0 ; |
||||
} |
||||
|
||||
:target { |
||||
background-color: #F8F8F8 ; |
||||
padding: 8px ; |
||||
border: solid #a0a0a0 2px ; |
||||
} |
||||
|
||||
.footer { |
||||
color: gray ; |
||||
font-size: small ; |
||||
} |
||||
|
||||
input[type=text] { |
||||
border: solid #a0a0a0 2px ; |
||||
border-radius: 2em ; |
||||
-moz-border-radius: 2em ; |
||||
background-image: url('images/search.png') ; |
||||
background-repeat: no-repeat; |
||||
background-position: 4px center ; |
||||
padding-left: 20px ; |
||||
height: 2em ; |
||||
} |
||||
|
@ -0,0 +1,172 @@
|
||||
<!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ --> |
||||
<HTML> |
||||
<HEAD> |
||||
<TITLE>LUA man page</TITLE> |
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css"> |
||||
</HEAD> |
||||
|
||||
<BODY BGCOLOR="#FFFFFF"> |
||||
|
||||
<H2>NAME</H2> |
||||
lua - Lua interpreter |
||||
<H2>SYNOPSIS</H2> |
||||
<B>lua</B> |
||||
[ |
||||
<I>options</I> |
||||
] |
||||
[ |
||||
<I>script</I> |
||||
[ |
||||
<I>args</I> |
||||
] |
||||
] |
||||
<H2>DESCRIPTION</H2> |
||||
<B>lua</B> |
||||
is the stand-alone Lua interpreter. |
||||
It loads and executes Lua programs, |
||||
either in textual source form or |
||||
in precompiled binary form. |
||||
(Precompiled binaries are output by |
||||
<B>luac</B>, |
||||
the Lua compiler.) |
||||
<B>lua</B> |
||||
can be used as a batch interpreter and also interactively. |
||||
<P> |
||||
The given |
||||
<I>options</I> |
||||
(see below) |
||||
are executed and then |
||||
the Lua program in file |
||||
<I>script</I> |
||||
is loaded and executed. |
||||
The given |
||||
<I>args</I> |
||||
are available to |
||||
<I>script</I> |
||||
as strings in a global table named |
||||
<B>arg</B>. |
||||
If these arguments contain spaces or other characters special to the shell, |
||||
then they should be quoted |
||||
(but note that the quotes will be removed by the shell). |
||||
The arguments in |
||||
<B>arg</B> |
||||
start at 0, |
||||
which contains the string |
||||
'<I>script</I>'. |
||||
The index of the last argument is stored in |
||||
<B>arg.n</B>. |
||||
The arguments given in the command line before |
||||
<I>script</I>, |
||||
including the name of the interpreter, |
||||
are available in negative indices in |
||||
<B>arg</B>. |
||||
<P> |
||||
At the very start, |
||||
before even handling the command line, |
||||
<B>lua</B> |
||||
executes the contents of the environment variable |
||||
<B>LUA_INIT</B>, |
||||
if it is defined. |
||||
If the value of |
||||
<B>LUA_INIT</B> |
||||
is of the form |
||||
'@<I>filename</I>', |
||||
then |
||||
<I>filename</I> |
||||
is executed. |
||||
Otherwise, the string is assumed to be a Lua statement and is executed. |
||||
<P> |
||||
Options start with |
||||
<B>'-'</B> |
||||