aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-08-30 15:58:46 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-08-30 15:58:46 -0300
commit2d3ebba537ce6257608b7cf3b5f65fff144b21e8 (patch)
treea88b637fddeb196d1c34c665759ae7961f9a1459
parenta97f29f15487c5f584185f646f9cfc06a04b26ca (diff)
downloadlua-2d3ebba537ce6257608b7cf3b5f65fff144b21e8.tar.gz
lua-2d3ebba537ce6257608b7cf3b5f65fff144b21e8.tar.bz2
lua-2d3ebba537ce6257608b7cf3b5f65fff144b21e8.zip
last version before new API
-rw-r--r--manual.tex277
1 files changed, 145 insertions, 132 deletions
diff --git a/manual.tex b/manual.tex
index 85d81b17..64f18c50 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.40 2000/08/09 19:09:20 roberto Exp roberto $ 1% $Id: manual.tex,v 1.41 2000/08/14 19:18:14 roberto Exp roberto $
2 2
3\documentclass[11pt]{article} 3\documentclass[11pt]{article}
4\usepackage{fullpage,bnf} 4\usepackage{fullpage,bnf}
@@ -27,6 +27,7 @@
27 27
28% LHF 28% LHF
29\renewcommand{\ter}[1]{{\rm`{\tt#1}'}} 29\renewcommand{\ter}[1]{{\rm`{\tt#1}'}}
30\newcommand{\Nter}[1]{{\rm{\tt#1}}}
30\newcommand{\NOTE}{\par\noindent\emph{NOTE}: } 31\newcommand{\NOTE}{\par\noindent\emph{NOTE}: }
31 32
32\makeindex 33\makeindex
@@ -122,7 +123,7 @@ Waldemar Celes
122\tecgraf\ --- Computer Science Department --- PUC-Rio 123\tecgraf\ --- Computer Science Department --- PUC-Rio
123} 124}
124 125
125\date{{\small \tt\$Date: 2000/08/09 19:09:20 $ $}} 126\date{{\small \tt\$Date: 2000/08/14 19:18:14 $ $}}
126 127
127\maketitle 128\maketitle
128 129
@@ -267,7 +268,7 @@ A chunk is simply a sequence of statements,
267which are executed sequentially. 268which are executed sequentially.
268Each statement can be optionally followed by a semicolon: 269Each statement can be optionally followed by a semicolon:
269\begin{Produc} 270\begin{Produc}
270\produc{chunk}{\rep{stat} \opt{\ter{;}}} 271\produc{chunk}{\rep{stat \opt{\ter{;}}}}
271\end{Produc}% 272\end{Produc}%
272Statements are described in \See{stats}. 273Statements are described in \See{stats}.
273(The notation above is the usual extended BNF, 274(The notation above is the usual extended BNF,
@@ -664,7 +665,7 @@ The table \rwd{for} statement traverses all pairs
664index--value of a given table. 665index--value of a given table.
665It has the following syntax: 666It has the following syntax:
666\begin{Produc} 667\begin{Produc}
667\produc{stat}{\rwd{for} name \ter{,} name \rwd{in} exp 668\produc{stat}{\rwd{for} name \ter{,} name \rwd{in} exp1
668 \rwd{do} block \rwd{end}} 669 \rwd{do} block \rwd{end}}
669\end{Produc}% 670\end{Produc}%
670A \rwd{for} statement like 671A \rwd{for} statement like
@@ -974,7 +975,7 @@ Arguments have the following syntax:
974\begin{Produc} 975\begin{Produc}
975\produc{args}{\ter{(} \opt{explist1} \ter{)}} 976\produc{args}{\ter{(} \opt{explist1} \ter{)}}
976\produc{args}{tableconstructor} 977\produc{args}{tableconstructor}
977\produc{args}{\ter{literal}} 978\produc{args}{\Nter{literal}}
978\produc{explist1}{\rep{exp1 \ter{,}} exp} 979\produc{explist1}{\rep{exp1 \ter{,}} exp}
979\end{Produc}% 980\end{Produc}%
980All argument expressions are evaluated before the call. 981All argument expressions are evaluated before the call.
@@ -1561,7 +1562,7 @@ the stack size for the interpreter and a boolean that
1561indicates whether the predefined functions should be loaded or not. 1562indicates whether the predefined functions should be loaded or not.
1562Each function call needs one stack position for each local variable 1563Each function call needs one stack position for each local variable
1563and temporary variables, plus one position for book-keeping. 1564and temporary variables, plus one position for book-keeping.
1564The stack must also have at least ten extra positions available. 1565The stack must also have some 20 extra positions available.
1565For very small implementations, without recursive functions, 1566For very small implementations, without recursive functions,
1566a stack size of 100 should be enough. 1567a stack size of 100 should be enough.
1567A value 0 for \verb|stacksize| uses a default size of 1024 positions. 1568A value 0 for \verb|stacksize| uses a default size of 1024 positions.
@@ -1599,51 +1600,6 @@ to avoid growing too big.
1599With the exception of \verb|lua_newstate|, 1600With the exception of \verb|lua_newstate|,
1600all functions in the API need a state as their first argument. 1601all functions in the API need a state as their first argument.
1601 1602
1602>>>>>>>>>>>>
1603However, most applications use a single state.
1604To avoid the burden of passing this only state explicitly to all
1605functions, and also to keep compatibility with old versions of Lua,
1606the API provides a set of macros and one global variable that
1607take care of this state argument for single-state applications:
1608\begin{verbatim}
1609#ifndef LUA_REENTRANT
1610\end{verbatim}
1611\begin{verbatim}
1612extern lua_State *lua_state;
1613\end{verbatim}
1614\begin{verbatim}
1615#define lua_close() (lua_close)(lua_state)
1616#define lua_dofile(filename) (lua_dofile)(lua_state, filename)
1617#define lua_dostring(str) (lua_dostring)(lua_state, str)
1618 ...
1619\end{verbatim}
1620\begin{verbatim}
1621#endif
1622\end{verbatim}
1623For each function in the API, there is a macro with the same name
1624that supplies \verb|lua_state| as the first argument to the call.
1625(The parentheses around the function name avoid it being expanded
1626again as a macro.)
1627The only exception is \verb|lua_newstate|;
1628in this case, the corresponding macro is
1629\begin{verbatim}
1630#define lua_open() ((void)(lua_state?0:(lua_state=lua_newstate(0, 1))))
1631\end{verbatim}
1632This code checks whether the global state has been initialized;
1633if not, it creates a new state with default settings and
1634assigns it to \verb|lua_state|.
1635
1636By default, the single-state macros are all active.
1637If you need to use multiple states,
1638and therefore will provide the state argument explicitly in each call,
1639you should define \IndexVerb{LUA_REENTRANT} before
1640including \verb|lua.h| in your code:
1641\begin{verbatim}
1642#define LUA_REENTRANT
1643#include "lua.h"
1644\end{verbatim}
1645<<<<<<<<<
1646
1647 1603
1648\subsection{Exchanging Values between C and Lua} \label{valuesCLua} 1604\subsection{Exchanging Values between C and Lua} \label{valuesCLua}
1649Because Lua has no static type system, 1605Because Lua has no static type system,
@@ -1801,9 +1757,9 @@ nested blocks can be defined with the functions
1801void lua_beginblock (lua_State *L); 1757void lua_beginblock (lua_State *L);
1802void lua_endblock (lua_State *L); 1758void lua_endblock (lua_State *L);
1803\end{verbatim} 1759\end{verbatim}
1804After the end of the block, 1760At the end of a block,
1805all \verb|lua_Object|s created inside it are released. 1761Lua releases all \verb|lua_Object|s created inside the block,
1806The \verb|lua_endblock| function also empties the C2Lua stack. 1762and empties the C2lua stack.
1807 1763
1808\subsection{Garbage Collection}\label{GC} 1764\subsection{Garbage Collection}\label{GC}
1809Because Lua has automatic memory management and garbage collection, 1765Because Lua has automatic memory management and garbage collection,
@@ -2026,7 +1982,7 @@ equivalent to the Lua code:
2026 lua_setglobal(L, "b"); /* set global variable 'b' */ 1982 lua_setglobal(L, "b"); /* set global variable 'b' */
2027\end{verbatim} 1983\end{verbatim}
2028 1984
2029Some special Lua functions have exclusive interfaces. 1985Some special Lua functions have direct interfaces.
2030The host program can generate a Lua error calling the function 1986The host program can generate a Lua error calling the function
2031\Deffunc{lua_error} 1987\Deffunc{lua_error}
2032\begin{verbatim} 1988\begin{verbatim}
@@ -2071,13 +2027,13 @@ int lua_next (lua_State *L, lua_Object t, int i);
2071\end{verbatim} 2027\end{verbatim}
2072Its first argument is the table to be traversed, 2028Its first argument is the table to be traversed,
2073and the second is a \emph{cursor}; 2029and the second is a \emph{cursor};
2074this cursor starts in 0, 2030this cursor starts at 0,
2075and for each call the function returns a value to 2031and for each call the function returns a value to
2076be used in the next call, 2032be used in the next call,
2077or 0 to signal the end of the traversal. 2033or 0 to signal the end of the traversal.
2078The function also returns, in the Lua2C array, 2034The function also returns, in the lua2C array,
2079a key-value pair from the table. 2035a key-value pair from the table.
2080A typical traversal looks like the following code: 2036A typical traversal looks like this:
2081\begin{verbatim} 2037\begin{verbatim}
2082 int i; 2038 int i;
2083 lua_Object t; 2039 lua_Object t;
@@ -2161,12 +2117,12 @@ If the C code needs to keep a \verb|lua_Object|
2161outside block boundaries, 2117outside block boundaries,
2162then it must create a \Def{reference} to the object. 2118then it must create a \Def{reference} to the object.
2163The routines to manipulate references are the following: 2119The routines to manipulate references are the following:
2164\Deffunc{lua_ref}\Deffunc{lua_getref} 2120\Deffunc{lua_ref}\Deffunc{lua_pushref}
2165\Deffunc{lua_unref} 2121\Deffunc{lua_unref}
2166\begin{verbatim} 2122\begin{verbatim}
2167int lua_ref (lua_State *L, int lock); 2123int lua_ref (lua_State *L, int lock);
2168lua_Object lua_getref (lua_State *L, int ref); 2124int lua_pushref (lua_State *L, int ref);
2169void lua_unref (lua_State *L, int ref); 2125void lua_unref (lua_State *L, int ref);
2170\end{verbatim} 2126\end{verbatim}
2171The function \verb|lua_ref| creates a reference 2127The function \verb|lua_ref| creates a reference
2172to the object that is on the top of the stack, 2128to the object that is on the top of the stack,
@@ -2180,10 +2136,10 @@ If \verb|lock| is true, then the object is \emph{locked}:
2180this means the object will not be garbage collected. 2136this means the object will not be garbage collected.
2181\emph{Unlocked references may be garbage collected}. 2137\emph{Unlocked references may be garbage collected}.
2182Whenever the referenced object is needed in~C, 2138Whenever the referenced object is needed in~C,
2183a call to \verb|lua_getref| 2139a call to \verb|lua_pushref|
2184returns a handle to it; 2140pushes that object into the C2lua stack;
2185if the object has been collected, 2141if the object has been collected,
2186\verb|lua_getref| returns \verb|LUA_NOOBJECT|. 2142\verb|lua_getref| returns 0 (and does not push anything).
2187 2143
2188When a reference is no longer needed, 2144When a reference is no longer needed,
2189it can be released with a call to \verb|lua_unref|. 2145it can be released with a call to \verb|lua_unref|.
@@ -3257,7 +3213,7 @@ it returns 0.
3257The structure \verb|lua_Debug| is used to carry different pieces of information 3213The structure \verb|lua_Debug| is used to carry different pieces of information
3258about an active function: 3214about an active function:
3259\begin{verbatim} 3215\begin{verbatim}
3260struct lua_Debug { 3216typedef struct lua_Debug {
3261 const char *event; /* "call", "return" */ 3217 const char *event; /* "call", "return" */
3262 const char *source; /* (S) */ 3218 const char *source; /* (S) */
3263 int linedefined; /* (S) */ 3219 int linedefined; /* (S) */
@@ -3269,7 +3225,7 @@ struct lua_Debug {
3269 lua_Object func; /* (f) function being executed */ 3225 lua_Object func; /* (f) function being executed */
3270 /* private part */ 3226 /* private part */
3271 ... 3227 ...
3272}; 3228} lua_Debug;
3273\end{verbatim} 3229\end{verbatim}
3274The \verb|lua_getstack| function fills only the private part 3230The \verb|lua_getstack| function fills only the private part
3275of this structure, for future use. 3231of this structure, for future use.
@@ -3282,9 +3238,10 @@ This function returns 0 on error
3282(e.g., an invalid option in \verb|what|). 3238(e.g., an invalid option in \verb|what|).
3283Each character in the string \verb|what| 3239Each character in the string \verb|what|
3284selects some fields of \verb|ar| to be filled, 3240selects some fields of \verb|ar| to be filled,
3285as indicated by the letter in parentheses in the definition of \verb|lua_Debug|; 3241as indicated by the letter in parentheses in the definition of \verb|lua_Debug|:
3286that is, an \verb|S| fills the fields \verb|source| and \verb|linedefined|, 3242An \verb|S| fills in the fields \verb|source|, \verb|linedefined|,
3287and \verb|l| fills the field \verb|currentline|, etc. 3243and \verb|what|;
3244\verb|l| fills in the field \verb|currentline|, etc.
3288 3245
3289To get information about a function that is not active (that is, 3246To get information about a function that is not active (that is,
3290it is not in the stack), 3247it is not in the stack),
@@ -3310,7 +3267,7 @@ if the function was defined in a file,
3310\verb|source| starts with a \verb|@| followed by the file name. 3267\verb|source| starts with a \verb|@| followed by the file name.
3311 3268
3312\item[linedefined] 3269\item[linedefined]
3313the line number where starts the definition of the function. 3270the line number where the definition of the function starts.
3314 3271
3315\item[what] the string \verb|"Lua"| if this is a Lua function, 3272\item[what] the string \verb|"Lua"| if this is a Lua function,
3316\verb|"C"| if this is a C~function, 3273\verb|"C"| if this is a C~function,
@@ -3345,9 +3302,7 @@ if the function is a tag method,
3345otherwise \verb|namewhat| is \verb|""| (the empty string). 3302otherwise \verb|namewhat| is \verb|""| (the empty string).
3346 3303
3347\item[nups] 3304\item[nups]
3348Number of upvalues of a C~function. 3305Number of upvalues of a function.
3349If the function is not a C~function,
3350\verb|nups| is set to 0.
3351 3306
3352\item[func] 3307\item[func]
3353The function being executed, as a \verb|lua_Object|. 3308The function being executed, as a \verb|lua_Object|.
@@ -3388,24 +3343,20 @@ value of that variable.
3388For \verb|lua_setlocal|, 3343For \verb|lua_setlocal|,
3389you fill the \verb|index| and the \verb|value| fields of \verb|v|, 3344you fill the \verb|index| and the \verb|value| fields of \verb|v|,
3390and the function assigns that value to the variable. 3345and the function assigns that value to the variable.
3391Both functions return 0 on failure, that happens 3346Both functions return 0 on failure;
3392if the index is greater than the number of active local variables. 3347that happens if the index is greater than the number of active local variables.
3393 3348
3394As an example, the following function lists the names of all 3349As an example, the following function lists the names of all
3395local variables for a function in a given level of the stack: 3350local variables for a function in a given level of the stack:
3396\begin{verbatim} 3351\begin{verbatim}
3397int listvars (lua_State *L, int level) { 3352int listvars (lua_State *L, int level) {
3398 lua_Debug ar; 3353 lua_Debug ar;
3399 int i; 3354 lua_Localvar v;
3400 if (lua_getstack(L, level, &ar) == 0) 3355 if (lua_getstack(L, level, &ar) == 0)
3401 return 0; /* failure: no such level on the stack */ 3356 return 0; /* failure: no such level on the stack */
3402 for (i=1; ; i++) { 3357 for (v.index = 1; lua_getlocal(L, &ar, &v); v.index++)
3403 lua_Localvar v;
3404 v.index = i;
3405 if (lua_getlocal(L, &ar, &v) == 0)
3406 return 1; /* no more locals */
3407 printf("%s\n", v.name); 3358 printf("%s\n", v.name);
3408 } 3359 return 1;
3409} 3360}
3410\end{verbatim} 3361\end{verbatim}
3411 3362
@@ -3505,7 +3456,7 @@ until the last active local variable.)
3505The function returns \nil\ if there is no local 3456The function returns \nil\ if there is no local
3506variable with the given index, 3457variable with the given index,
3507and raises an error when called with a \verb|level| out of range. 3458and raises an error when called with a \verb|level| out of range.
3508(You can call \verb|getstack| to check wheter the level is valid.) 3459(You can call \verb|getstack| to check whether the level is valid.)
3509 3460
3510\subsubsection*{\ff \T{setlocal (level, local, value)}}\Deffunc{setlocal} 3461\subsubsection*{\ff \T{setlocal (level, local, value)}}\Deffunc{setlocal}
3511 3462
@@ -3638,43 +3589,96 @@ some differences had to be introduced.
3638Here is a list of all these incompatibilities. 3589Here is a list of all these incompatibilities.
3639 3590
3640\subsection*{Incompatibilities with \Index{version 3.2}} 3591\subsection*{Incompatibilities with \Index{version 3.2}}
3592
3593\subsubsection*{Changes in the Language}
3641\begin{itemize} 3594\begin{itemize}
3642 3595
3643\item 3596\item
3644General read patterns are now deprecated. 3597All pragmas (\verb|$debug|, \verb|$if|, \ldots) are deprecated.
3598
3599\item \rwd{for}, \rwd{break}, and \rwd{in} now are reserved words.
3600
3645\item 3601\item
3646Garbage-collection tag methods for tables is now deprecated. 3602Garbage-collection tag methods for tables is now deprecated.
3603
3647\item 3604\item
3648\verb|setglobal|, \verb|rawsetglobal|, and \verb|sort| no longer return a value; 3605There is now only one tag method for order operators.
3649\verb|type| no longer return a second value. 3606
3650\item 3607\item
3651In nested function calls like \verb|f(g(x))| 3608In nested function calls like \verb|f(g(x))|
3652\emph{all} return values from \verb|g| are passed as arguments to \verb|f|. 3609\emph{all} return values from \verb|g| are passed as arguments to \verb|f|.
3653(This only happens when \verb|g| is the last 3610(This only happens when \verb|g| is the last
3654[or the only] argument to \verb|f|.) 3611[or the only] argument to \verb|f|.)
3612
3655\item 3613\item
3656There is now only one tag method for order operators. 3614The pre-compiler may assume that some operators are associative,
3657\item
3658The debug API has been completely rewritten.
3659\item
3660The pre-compiler may use the fact that some operators are associative,
3661for optimizations. 3615for optimizations.
3662This may cause problems if these operators 3616This may cause problems if these operators
3663have non-associative tag methods. 3617have non-associative tag methods.
3618
3619\item Old pre-compiled code is obsolete, and must be re-compiled.
3620
3621\end{itemize}
3622
3623
3624\subsubsection*{Changes in the Libraries}
3625\begin{itemize}
3626
3664\item 3627\item
3665All functions from the old API are now macros. 3628General read patterns are now deprecated.
3629
3630\item
3631The functions \verb|rawgettable| and \verb|rawsettable|
3632were renamed to \verb|rawget| and \verb|rawset|.
3633
3634\item
3635The functions \verb|foreachvar|, \verb|nextvar|,
3636\verb|rawsetglobal|, and \verb|rawgetglobal| are deprecated.
3637You can get their functionality using table operations
3638over the table of globals.
3639
3640\item
3641\verb|setglobal| and \verb|sort| no longer return a value;
3642\verb|type| no longer returns a second value.
3643
3644\end{itemize}
3645
3646
3647\subsubsection*{Changes in the API}
3648\begin{itemize}
3649
3650\item
3651The whole API is now reentrant,
3652which means that all functions have
3653an extra first argument, a Lua state.
3654You can still use the old format:
3655If you define \verb|LUA_SINGLESTATE| before including \verb|lua.h|,
3656all functions from the old API are defined as macros.
3657You will also have to define a variable
3658\begin{verbatim}
3659lua_State *lua_state = NULL;
3660\end{verbatim}
3661somewhere in your program.
3662
3663\item
3664The debug API has been completely rewritten.
3665
3666\item 3666\item
3667A \verb|const| qualifier has been added to \verb|char *| 3667A \verb|const| qualifier has been added to \verb|char *|
3668in all API functions that handle C~strings. 3668in all API functions that handle C~strings.
3669
3670\item
3671Some types \verb|long| were changed to \verb|size_t|.
3672
3669\item 3673\item
3670\verb|luaL_openlib| no longer automatically calls \verb|lua_open|. 3674\verb|luaL_openlib| no longer automatically calls \verb|lua_open|.
3671So, 3675So,
3672you must now explicitly call \verb|lua_open| before opening 3676you must now explicitly call \verb|lua_open| before opening
3673the standard libraries. 3677the standard libraries.
3678
3674\item 3679\item
3675\verb|lua_type| now returns a string describing the type, 3680\verb|lua_type| now returns a string describing the type,
3676and is no longer a synonym for \verb|lua_tag|. 3681and is no longer a synonym for \verb|lua_tag|.
3677\item Old pre-compiled code is obsolete, and must be re-compiled.
3678 3682
3679\end{itemize} 3683\end{itemize}
3680 3684
@@ -3687,7 +3691,7 @@ and is no longer a synonym for \verb|lua_tag|.
3687 3691
3688\begin{Produc} 3692\begin{Produc}
3689 3693
3690\produc{chunk}{\rep{stat} \opt{\ter{;}}} 3694\produc{chunk}{\rep{stat \opt{\ter{;}}}}
3691 3695
3692\produc{block}{chunk} 3696\produc{block}{chunk}
3693 3697
@@ -3702,43 +3706,72 @@ and is no longer a synonym for \verb|lua_tag|.
3702 \opt{\rwd{else} block} \rwd{end} 3706 \opt{\rwd{else} block} \rwd{end}
3703\OrNL \rwd{return} \opt{explist1} 3707\OrNL \rwd{return} \opt{explist1}
3704\OrNL \rwd{break} 3708\OrNL \rwd{break}
3705\OrNL \rwd{for} name \ter{=} exp1 \ter{,} exp1 \opt{\ter{,} exp1} 3709\OrNL \rwd{for} \Nter{name} \ter{=} exp1 \ter{,} exp1 \opt{\ter{,} exp1}
3706 \rwd{do} block \rwd{end} 3710 \rwd{do} block \rwd{end}
3711\OrNL \rwd{for} \Nter{name} \ter{,} \Nter{name} \rwd{in} exp1
3712 \rwd{do} block \rwd{end}
3707\OrNL \rwd{function} funcname \ter{(} \opt{parlist1} \ter{)} block \rwd{end} 3713\OrNL \rwd{function} funcname \ter{(} \opt{parlist1} \ter{)} block \rwd{end}
3708\OrNL \rwd{local} declist \opt{init} 3714\OrNL \rwd{local} declist \opt{init}
3709} 3715}
3710 3716
3717\produc{funcname}{%
3718 \Nter{name}
3719\Or \Nter{name} \ter{.} \Nter{name}
3720\Or \Nter{name} \ter{:} \Nter{name}
3721}
3722
3723\produc{varlist1}{var \rep{\ter{,} var}}
3724
3711\produc{var}{% 3725\produc{var}{%
3712 name 3726 \Nter{name}
3713\OrNL varorfunc \ter{[} exp1 \ter{]} 3727\Or varorfunc \ter{[} exp1 \ter{]}
3714\OrNL varorfunc \ter{.} name 3728\Or varorfunc \ter{.} \Nter{name}
3715} 3729}
3716 3730
3717\produc{varorfunc}{var \Or functioncall} 3731\produc{varorfunc}{var \Or functioncall}
3718 3732
3719\produc{varlist1}{var \rep{\ter{,} var}} 3733\produc{declist}{\Nter{name} \rep{\ter{,} \Nter{name}}}
3720
3721\produc{declist}{name \rep{\ter{,} name}}
3722 3734
3723\produc{init}{\ter{=} explist1} 3735\produc{init}{\ter{=} explist1}
3724 3736
3737\produc{explist1}{\rep{exp1 \ter{,}} exp}
3738
3739\produc{exp1}{exp}
3740
3725\produc{exp}{% 3741\produc{exp}{%
3726 \rwd{nil} 3742 \rwd{nil}
3727\Or number 3743\Or \Nter{number}
3728\Or literal 3744\Or \Nter{literal}
3745\Or var
3729\Or function 3746\Or function
3730\Or upvalue 3747\Or upvalue
3731\Or functioncall 3748\OrNL functioncall
3732\Or tableconstructor 3749\Or tableconstructor
3733\Or \ter{(} exp \ter{)} 3750\Or \ter{(} exp \ter{)}
3734\Or exp binop exp 3751\Or exp binop exp
3735\Or unop exp 3752\Or unop exp
3736} 3753}
3737 3754
3738\produc{exp1}{exp}
3739 3755
3740\produc{explist1}{\rep{exp1 \ter{,}} exp} 3756\produc{functioncall}{%
3757 varorfunc args
3758\Or varorfunc \ter{:} \Nter{name} args
3759}
3760
3761\produc{args}{%
3762 \ter{(} \opt{explist1} \ter{)}
3763\Or tableconstructor
3764\Or \Nter{literal}
3765}
3766
3767\produc{function}{\rwd{function} \ter{(} \opt{parlist1} \ter{)} block \rwd{end}}
3768
3769\produc{parlist1}{%
3770 \ter{\ldots}
3771\Or \Nter{name} \rep{\ter{,} \Nter{name}} \opt{\ter{,} \ter{\ldots}}
3772}
3741 3773
3774\produc{upvalue}{\ter{\%} \Nter{name}}
3742 3775
3743\produc{tableconstructor}{\ter{\{} fieldlist \ter{\}}} 3776\produc{tableconstructor}{\ter{\{} fieldlist \ter{\}}}
3744\produc{fieldlist}{% 3777\produc{fieldlist}{%
@@ -3753,34 +3786,14 @@ and is no longer a synonym for \verb|lua_tag|.
3753\produc{ffieldlist1}{ffield \rep{\ter{,} ffield} \opt{\ter{,}}} 3786\produc{ffieldlist1}{ffield \rep{\ter{,} ffield} \opt{\ter{,}}}
3754\produc{ffield}{% 3787\produc{ffield}{%
3755 \ter{[} exp \ter{]} \ter{=} exp 3788 \ter{[} exp \ter{]} \ter{=} exp
3756\Or name \ter{=} exp 3789\Or \Nter{name} \ter{=} exp
3757} 3790}
3758 3791
3759\produc{functioncall}{% 3792\produc{binop}{\ter{+} \Or \ter{-} \Or \ter{*} \Or \ter{/} \Or \ter{\^{ }} \Or
3760 varorfunc args 3793 \ter{..} \OrNL \ter{<} \Or \ter{<=} \Or \ter{>} \Or \ter{>=}
3761\Or varorfunc \ter{:} name args 3794 \Or \ter{==} \Or \ter{\~{ }=} \OrNL \rwd{and} \Or \rwd{or}}
3762}
3763 3795
3764\produc{args}{% 3796\produc{unop}{\ter{-} \Or \rwd{not}}
3765 \ter{(} \opt{explist1} \ter{)}
3766\Or tableconstructor
3767\Or \ter{literal}
3768}
3769
3770\produc{function}{\rwd{function} \ter{(} \opt{parlist1} \ter{)} block \rwd{end}}
3771
3772\produc{funcname}{%
3773 name
3774\OrNL name \ter{.} name
3775\OrNL name \ter{:} name
3776}
3777
3778\produc{parlist1}{%
3779 \ter{\ldots}
3780\Or name \rep{\ter{,} name} \opt{\ter{,} \ter{\ldots}}
3781}
3782
3783\produc{upvalue}{\ter{\%} name}
3784 3797
3785\end{Produc} 3798\end{Produc}
3786%}=============================================================== 3799%}===============================================================