aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-01-22 14:29:38 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-01-22 14:29:38 -0200
commita153cafd8df6c3b6dfd13d3d99d7a39d912dc983 (patch)
tree1ac8c383952e1bc5539a1b3d2605fb8232f594bd
parent3b5158f2a1d7e44bc67bab5c443bf034c0e2cb47 (diff)
downloadlua-a153cafd8df6c3b6dfd13d3d99d7a39d912dc983.tar.gz
lua-a153cafd8df6c3b6dfd13d3d99d7a39d912dc983.tar.bz2
lua-a153cafd8df6c3b6dfd13d3d99d7a39d912dc983.zip
starting translation to new format (@comand{...}).
-rw-r--r--manual.tex347
1 files changed, 178 insertions, 169 deletions
diff --git a/manual.tex b/manual.tex
index 8d1d6fef..e49352be 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.65 2003/01/20 11:03:05 roberto Exp roberto $ 1% $Id: manual.tex,v 1.66 2003/01/21 17:45:11 roberto Exp roberto $
2%{[( 2%{[(
3 3
4\documentclass[11pt,twoside]{article} 4\documentclass[11pt,twoside]{article}
@@ -26,7 +26,7 @@
26\newcommand{\Index}[1]{#1\index{#1@{\lowercase{#1}}}} 26\newcommand{\Index}[1]{#1\index{#1@{\lowercase{#1}}}}
27\newcommand{\IndexVerb}[1]{\T{#1}\index{#1@{\tt #1}}} 27\newcommand{\IndexVerb}[1]{\T{#1}\index{#1@{\tt #1}}}
28\newcommand{\IndexEmph}[1]{\emph{#1}\index{#1@{\lowercase{#1}}}} 28\newcommand{\IndexEmph}[1]{\emph{#1}\index{#1@{\lowercase{#1}}}}
29\newcommand{\IndexTM}[1]{\index{#1 event@{``#1'' event}}\index{metamethod!#1}} 29\newcommand{\IndexTM}[1]{\index{#1 event@{\Q{#1} event}}\index{metamethod!#1}}
30\newcommand{\Def}[1]{\emph{#1}\index{#1}} 30\newcommand{\Def}[1]{\emph{#1}\index{#1}}
31\newcommand{\IndexAPI}[1]{\T{#1}\DefAPI{#1}} 31\newcommand{\IndexAPI}[1]{\T{#1}\DefAPI{#1}}
32\newcommand{\IndexLIB}[1]{\T{#1}\DefLIB{#1}} 32\newcommand{\IndexLIB}[1]{\T{#1}\DefLIB{#1}}
@@ -34,6 +34,11 @@
34\newcommand{\DefAPI}[1]{\index{C API!#1@{\tt #1}}} 34\newcommand{\DefAPI}[1]{\index{C API!#1@{\tt #1}}}
35\newcommand{\IndexKW}[1]{\index{keywords!#1@{\tt #1}}} 35\newcommand{\IndexKW}[1]{\index{keywords!#1@{\tt #1}}}
36 36
37\newcommand{\Q}[1]{``#1''}
38\newcommand{\Em}{---}
39\newcommand{\En}{--}
40\newcommand{\C}[1]{}
41
37\newcommand{\ff}{$\bullet$\ } 42\newcommand{\ff}{$\bullet$\ }
38 43
39\newcommand{\Version}{5.0 (beta)} 44\newcommand{\Version}{5.0 (beta)}
@@ -134,7 +139,7 @@ Waldemar Celes
134\tecgraf\ --- Computer Science Department --- PUC-Rio 139\tecgraf\ --- Computer Science Department --- PUC-Rio
135} 140}
136 141
137%\date{{\small \tt\$Date: 2003/01/20 11:03:05 $ $}} 142%\date{{\small \tt\$Date: 2003/01/21 17:45:11 $ $}}
138 143
139\maketitle 144\maketitle
140 145
@@ -202,7 +207,8 @@ a intera\c{c}\~ao entre programas Lua e programas C~hospedeiros.
202\pagestyle{plain} 207\pagestyle{plain}
203\pagenumbering{arabic} 208\pagenumbering{arabic}
204 209
205%------------------------------------------------------------------------------ 210
211\C{------------------------------------------------------------------------------}
206\section{Introduction} 212\section{Introduction}
207 213
208Lua is an extension programming language designed to support 214Lua is an extension programming language designed to support
@@ -212,7 +218,7 @@ Lua is intended to be used as a powerful, light-weight
212configuration language for any program that needs one. 218configuration language for any program that needs one.
213Lua is implemented as a library, written in C. 219Lua is implemented as a library, written in C.
214 220
215Being an extension language, Lua has no notion of a ``main'' program: 221Being an extension language, Lua has no notion of a \Q{main} program:
216it only works \emph{embedded} in a host client, 222it only works \emph{embedded} in a host client,
217called the \emph{embedding program} or simply the \emph{host}. 223called the \emph{embedding program} or simply the \emph{host}.
218This host program can invoke functions to execute a piece of Lua code, 224This host program can invoke functions to execute a piece of Lua code,
@@ -236,25 +242,25 @@ which are available at Lua's web site.
236\begin{itemize} 242\begin{itemize}
237\item 243\item
238R.~Ierusalimschy, L.~H.~de Figueiredo, and W.~Celes. 244R.~Ierusalimschy, L.~H.~de Figueiredo, and W.~Celes.
239Lua---an extensible extension language. 245Lua\Em{}an extensible extension language.
240\emph{Software: Practice \& Experience} {\bf 26} \#6 (1996) 635--652. 246\emph{Software: Practice \& Experience} {\bf 26} \#6 (1996) 635\En{}652.
241\item 247\item
242L.~H.~de Figueiredo, R.~Ierusalimschy, and W.~Celes. 248L.~H.~de Figueiredo, R.~Ierusalimschy, and W.~Celes.
243The design and implementation of a language for extending applications. 249The design and implementation of a language for extending applications.
244\emph{Proceedings of XXI Brazilian Seminar on Software and Hardware} (1994) 273--283. 250\emph{Proceedings of XXI Brazilian Seminar on Software and Hardware} (1994) 273\En{}283.
245\item 251\item
246L.~H.~de Figueiredo, R.~Ierusalimschy, and W.~Celes. 252L.~H.~de Figueiredo, R.~Ierusalimschy, and W.~Celes.
247Lua: an extensible embedded language. 253Lua: an extensible embedded language.
248\emph{Dr. Dobb's Journal} {\bf 21} \#12 (Dec 1996) 26--33. 254\emph{Dr. Dobb's Journal} {\bf 21} \#12 (Dec 1996) 26\En{}33.
249\item 255\item
250R.~Ierusalimschy, L.~H.~de Figueiredo, and W.~Celes. 256R.~Ierusalimschy, L.~H.~de Figueiredo, and W.~Celes.
251The evolution of an extension language: a history of Lua, 257The evolution of an extension language: a history of Lua,
252\emph{Proceedings of V Brazilian Symposium on Programming Languages} (2001) B-14--B-28. 258\emph{Proceedings of V Brazilian Symposium on Programming Languages} (2001) B-14\En{}B-28.
253\end{itemize} 259\end{itemize}
254 260
255Lua means ``moon'' in Portuguese. 261Lua means \Q{moon} in Portuguese.
256 262
257%------------------------------------------------------------------------------ 263\C{------------------------------------------------------------------------------}
258\section{Lua Concepts}\label{concepts} 264\section{Lua Concepts}\label{concepts}
259 265
260This section describes the main concepts of Lua as a language. 266This section describes the main concepts of Lua as a language.
@@ -513,7 +519,7 @@ If \verb|__mode| contains \verb|v|,
513the values in the table are weak. 519the values in the table are weak.
514 520
515 521
516%------------------------------------------------------------------------------ 522\C{------------------------------------------------------------------------------}
517\section{The Language}\label{language} 523\section{The Language}\label{language}
518 524
519This section describes the lexis, the syntax, and the semantics of Lua. 525This section describes the lexis, the syntax, and the semantics of Lua.
@@ -588,7 +594,7 @@ may contain nested \verb|[[| $\ldots$ \verb|]]| pairs,
588and do not interpret escape sequences. 594and do not interpret escape sequences.
589For convenience, 595For convenience,
590when the opening \verb|[[| is immediately followed by a newline, 596when the opening \verb|[[| is immediately followed by a newline,
591the newline is not included in the string. % ]] 597the newline is not included in the string. \C{ ]]}
592That form is specially convenient for 598That form is specially convenient for
593writing strings that contain program pieces or 599writing strings that contain program pieces or
594other quoted strings. 600other quoted strings.
@@ -631,18 +637,18 @@ in Unix systems \see{lua-sa}.
631\subsection{Variables}\label{variables} 637\subsection{Variables}\label{variables}
632 638
633Variables are places that store values. 639Variables are places that store values.
634%In Lua, variables are given by simple identifiers or by table fields. 640\C{In Lua, variables are given by simple identifiers or by table fields.}
635 641
636A single name can denote a global variable, a local variable, 642A single name can denote a global variable, a local variable,
637or a formal parameter in a function 643or a formal parameter in a function
638(formal parameters are just local variables): 644(formal parameters are just local variables):
639\begin{Produc} 645\begin{Produc}
640\produc{var}{\Nter{Name}} 646\produc{var}{\Nter{Name}}
641\end{Produc}% 647\end{Produc}
642Square brackets are used to index a table: 648Square brackets are used to index a table:
643\begin{Produc} 649\begin{Produc}
644\produc{var}{prefixexp \ter{[} exp \ter{]}} 650\produc{var}{prefixexp \ter{[} exp \ter{]}}
645\end{Produc}% 651\end{Produc}
646The first expression should result in a table value, 652The first expression should result in a table value,
647and the second expression identifies a specific entry inside that table. 653and the second expression identifies a specific entry inside that table.
648 654
@@ -650,7 +656,7 @@ The syntax \verb|var.NAME| is just syntactic sugar for
650\verb|var["NAME"]|: 656\verb|var["NAME"]|:
651\begin{Produc} 657\begin{Produc}
652\produc{var}{prefixexp \ter{.} \Nter{Name}} 658\produc{var}{prefixexp \ter{.} \Nter{Name}}
653\end{Produc}% 659\end{Produc}
654 660
655The expression denoting the table to be indexed has a restricted syntax; 661The expression denoting the table to be indexed has a restricted syntax;
656see \See{expressions} for details. 662see \See{expressions} for details.
@@ -691,19 +697,19 @@ which are executed sequentially.
691Each statement can be optionally followed by a semicolon: 697Each statement can be optionally followed by a semicolon:
692\begin{Produc} 698\begin{Produc}
693\produc{chunk}{\rep{stat \opt{\ter{;}}}} 699\produc{chunk}{\rep{stat \opt{\ter{;}}}}
694\end{Produc}% 700\end{Produc}
695 701
696\subsubsection{Blocks} 702\subsubsection{Blocks}
697A \Index{block} is a list of statements; 703A \Index{block} is a list of statements;
698syntactically, a block is equal to a chunk: 704syntactically, a block is equal to a chunk:
699\begin{Produc} 705\begin{Produc}
700\produc{block}{chunk} 706\produc{block}{chunk}
701\end{Produc}% 707\end{Produc}
702 708
703A block may be explicitly delimited to produce a single statement: 709A block may be explicitly delimited to produce a single statement:
704\begin{Produc} 710\begin{Produc}
705\produc{stat}{\rwd{do} block \rwd{end}} 711\produc{stat}{\rwd{do} block \rwd{end}}
706\end{Produc}% 712\end{Produc}
707\IndexKW{do} 713\IndexKW{do}
708Explicit blocks are useful 714Explicit blocks are useful
709to control the scope of variable declarations. 715to control the scope of variable declarations.
@@ -721,7 +727,7 @@ The elements in both lists are separated by commas:
721\produc{stat}{varlist1 \ter{=} explist1} 727\produc{stat}{varlist1 \ter{=} explist1}
722\produc{varlist1}{var \rep{\ter{,} var}} 728\produc{varlist1}{var \rep{\ter{,} var}}
723\produc{explist1}{exp \rep{\ter{,} exp}} 729\produc{explist1}{exp \rep{\ter{,} exp}}
724\end{Produc}% 730\end{Produc}
725Expressions are discussed in \See{expressions}. 731Expressions are discussed in \See{expressions}.
726 732
727Before the assignment, 733Before the assignment,
@@ -765,7 +771,7 @@ familiar syntax:
765\produc{stat}{\rwd{if} exp \rwd{then} block 771\produc{stat}{\rwd{if} exp \rwd{then} block
766 \rep{\rwd{elseif} exp \rwd{then} block} 772 \rep{\rwd{elseif} exp \rwd{then} block}
767 \opt{\rwd{else} block} \rwd{end}} 773 \opt{\rwd{else} block} \rwd{end}}
768\end{Produc}% 774\end{Produc}
769Lua also has a \rwd{for} statement, in two flavors \see{for}. 775Lua also has a \rwd{for} statement, in two flavors \see{for}.
770 776
771The \Index{condition expression} \M{exp} of a 777The \Index{condition expression} \M{exp} of a
@@ -776,13 +782,13 @@ All values different from \nil{} and \False{} are considered true
776 782
777The \rwd{return} statement is used to return values 783The \rwd{return} statement is used to return values
778from a function or from a chunk.\IndexKW{return} 784from a function or from a chunk.\IndexKW{return}
779\label{return}% 785\label{return}
780\index{return statement}% 786\index{return statement}
781Functions and chunks may return more than one value, 787Functions and chunks may return more than one value,
782so the syntax for the \rwd{return} statement is 788so the syntax for the \rwd{return} statement is
783\begin{Produc} 789\begin{Produc}
784\produc{stat}{\rwd{return} \opt{explist1}} 790\produc{stat}{\rwd{return} \opt{explist1}}
785\end{Produc}% 791\end{Produc}
786 792
787The \rwd{break} statement can be used to terminate the execution of a 793The \rwd{break} statement can be used to terminate the execution of a
788\rwd{while}, \rwd{repeat}, or \rwd{for} loop, 794\rwd{while}, \rwd{repeat}, or \rwd{for} loop,
@@ -790,7 +796,7 @@ and to skip to the next statement after the loop:\IndexKW{break}
790\index{break statement} 796\index{break statement}
791\begin{Produc} 797\begin{Produc}
792\produc{stat}{\rwd{break}} 798\produc{stat}{\rwd{break}}
793\end{Produc}% 799\end{Produc}
794A \rwd{break} ends the innermost enclosing loop. 800A \rwd{break} ends the innermost enclosing loop.
795 801
796\NOTE 802\NOTE
@@ -821,7 +827,7 @@ It has the following syntax:
821\begin{Produc} 827\begin{Produc}
822\produc{stat}{\rwd{for} \Nter{Name} \ter{=} exp \ter{,} exp \opt{\ter{,} exp} 828\produc{stat}{\rwd{for} \Nter{Name} \ter{=} exp \ter{,} exp \opt{\ter{,} exp}
823 \rwd{do} block \rwd{end}} 829 \rwd{do} block \rwd{end}}
824\end{Produc}% 830\end{Produc}
825The \emph{block} is repeated for \emph{name} starting at the value of 831The \emph{block} is repeated for \emph{name} starting at the value of
826the first \emph{exp}, until it passes the second \emph{exp} by steps of the 832the first \emph{exp}, until it passes the second \emph{exp} by steps of the
827third \emph{exp}. 833third \emph{exp}.
@@ -864,7 +870,7 @@ It has the following syntax:
864\begin{Produc} 870\begin{Produc}
865\produc{stat}{\rwd{for} \Nter{Name} \rep{\ter{,} \Nter{Name}} \rwd{in} explist1 871\produc{stat}{\rwd{for} \Nter{Name} \rep{\ter{,} \Nter{Name}} \rwd{in} explist1
866 \rwd{do} block \rwd{end}} 872 \rwd{do} block \rwd{end}}
867\end{Produc}% 873\end{Produc}
868A \rwd{for} statement like 874A \rwd{for} statement like
869\begin{verbatim} 875\begin{verbatim}
870 for var_1, ..., var_n in explist do block end 876 for var_1, ..., var_n in explist do block end
@@ -883,8 +889,8 @@ is equivalent to the code:
883Note the following: 889Note the following:
884\begin{itemize}\itemsep=0pt 890\begin{itemize}\itemsep=0pt
885\item \verb|explist| is evaluated only once. 891\item \verb|explist| is evaluated only once.
886Its results are a ``generator'' function, 892Its results are a \Q{generator} function,
887a ``state'', and an initial value for the first ``iterator variable''. 893a \Q{state}, and an initial value for the first \Q{iterator variable}.
888\item \verb|_f| and \verb|_s| are invisible variables. 894\item \verb|_f| and \verb|_s| are invisible variables.
889The names are here for explanatory purposes only. 895The names are here for explanatory purposes only.
890\item The behavior is \emph{undefined} if you assign to any 896\item The behavior is \emph{undefined} if you assign to any
@@ -902,7 +908,7 @@ Because of possible side-effects,
902function calls can be executed as statements: 908function calls can be executed as statements:
903\begin{Produc} 909\begin{Produc}
904\produc{stat}{functioncall} 910\produc{stat}{functioncall}
905\end{Produc}% 911\end{Produc}
906In this case, all returned values are thrown away. 912In this case, all returned values are thrown away.
907Function calls are explained in \See{functioncall}. 913Function calls are explained in \See{functioncall}.
908 914
@@ -912,7 +918,7 @@ The declaration may include an initial assignment:\IndexKW{local}
912\begin{Produc} 918\begin{Produc}
913\produc{stat}{\rwd{local} namelist \opt{\ter{=} explist1}} 919\produc{stat}{\rwd{local} namelist \opt{\ter{=} explist1}}
914\produc{namelist}{\Nter{Name} \rep{\ter{,} \Nter{Name}}} 920\produc{namelist}{\Nter{Name} \rep{\ter{,} \Nter{Name}}}
915\end{Produc}% 921\end{Produc}
916If present, an initial assignment has the same semantics 922If present, an initial assignment has the same semantics
917of a multiple assignment \see{assignment}. 923of a multiple assignment \see{assignment}.
918Otherwise, all variables are initialized with \nil. 924Otherwise, all variables are initialized with \nil.
@@ -926,7 +932,7 @@ Visibility rules for local variables are explained in \See{visibility}.
926 932
927\subsection{\Index{Expressions}}\label{expressions} 933\subsection{\Index{Expressions}}\label{expressions}
928 934
929%\subsubsection{\Index{Basic Expressions}} 935\C{\subsubsection{\Index{Basic Expressions}}}
930The basic expressions in Lua are the following: 936The basic expressions in Lua are the following:
931\begin{Produc} 937\begin{Produc}
932\produc{exp}{prefixexp} 938\produc{exp}{prefixexp}
@@ -936,7 +942,7 @@ The basic expressions in Lua are the following:
936\produc{exp}{function} 942\produc{exp}{function}
937\produc{exp}{tableconstructor} 943\produc{exp}{tableconstructor}
938\produc{prefixexp}{var \Or functioncall \Or \ter{(} exp \ter{)}} 944\produc{prefixexp}{var \Or functioncall \Or \ter{(} exp \ter{)}}
939\end{Produc}% 945\end{Produc}
940\IndexKW{nil}\IndexKW{false}\IndexKW{true} 946\IndexKW{nil}\IndexKW{false}\IndexKW{true}
941 947
942An expression enclosed in parentheses always results in only one value. 948An expression enclosed in parentheses always results in only one value.
@@ -985,7 +991,7 @@ Tables, userdata, and functions are compared \emph{by reference},
985that is, 991that is,
986two tables are considered equal only if they are the \emph{same} table. 992two tables are considered equal only if they are the \emph{same} table.
987 993
988%% TODO eq metamethod 994\C{TODO eq metamethod}
989 995
990Every time you create a new table (or userdata, or function), 996Every time you create a new table (or userdata, or function),
991this new value is different from any previously existing value. 997this new value is different from any previously existing value.
@@ -1004,7 +1010,7 @@ The order operators work as follows.
1004If both arguments are numbers, then they are compared as such. 1010If both arguments are numbers, then they are compared as such.
1005Otherwise, if both arguments are strings, 1011Otherwise, if both arguments are strings,
1006then their values are compared according to the current locale. 1012then their values are compared according to the current locale.
1007Otherwise, the ``lt'' or the ``le'' metamethod is called \see{metatable}. 1013Otherwise, the \Q{lt} or the \Q{le} metamethod is called \see{metatable}.
1008 1014
1009 1015
1010\subsubsection{Logical Operators} 1016\subsubsection{Logical Operators}
@@ -1045,7 +1051,7 @@ The string \Index{concatenation} operator in Lua is
1045denoted by two dots (`\verb|..|'). 1051denoted by two dots (`\verb|..|').
1046If both operands are strings or numbers, then they are converted to 1052If both operands are strings or numbers, then they are converted to
1047strings according to the rules mentioned in \See{coercion}. 1053strings according to the rules mentioned in \See{coercion}.
1048Otherwise, the ``concat'' metamethod is called \see{metatable}. 1054Otherwise, the \Q{concat} metamethod is called \see{metatable}.
1049 1055
1050\subsubsection{Precedence} 1056\subsubsection{Precedence}
1051\Index{Operator precedence} in Lua follows the table below, 1057\Index{Operator precedence} in Lua follows the table below,
@@ -1076,7 +1082,7 @@ The general syntax for constructors is
1076\produc{field}{\ter{[} exp \ter{]} \ter{=} exp \Or 1082\produc{field}{\ter{[} exp \ter{]} \ter{=} exp \Or
1077 \Nter{Name} \ter{=} exp \Or exp} 1083 \Nter{Name} \ter{=} exp \Or exp}
1078\produc{fieldsep}{\ter{,} \Or \ter{;}} 1084\produc{fieldsep}{\ter{,} \Or \ter{;}}
1079\end{Produc}% 1085\end{Produc}
1080 1086
1081Each field of the form \verb|[exp1] = exp2| adds to the new table an entry 1087Each field of the form \verb|[exp1] = exp2| adds to the new table an entry
1082with key \verb|exp1| and value \verb|exp2|. 1088with key \verb|exp1| and value \verb|exp2|.
@@ -1119,13 +1125,13 @@ as a convenience for machine-generated code.
1119A \Index{function call} in Lua has the following syntax: 1125A \Index{function call} in Lua has the following syntax:
1120\begin{Produc} 1126\begin{Produc}
1121\produc{functioncall}{prefixexp args} 1127\produc{functioncall}{prefixexp args}
1122\end{Produc}% 1128\end{Produc}
1123In a function call, 1129In a function call,
1124first \M{prefixexp} and \M{args} are evaluated. 1130first \M{prefixexp} and \M{args} are evaluated.
1125If the value of \M{prefixexp} has type \emph{function}, 1131If the value of \M{prefixexp} has type \emph{function},
1126then that function is called, 1132then that function is called,
1127with the given arguments. 1133with the given arguments.
1128Otherwise, its ``call'' metamethod is called, 1134Otherwise, its \Q{call} metamethod is called,
1129having as first parameter the value of \M{prefixexp}, 1135having as first parameter the value of \M{prefixexp},
1130followed by the original call arguments 1136followed by the original call arguments
1131\see{metatable}. 1137\see{metatable}.
@@ -1133,8 +1139,8 @@ followed by the original call arguments
1133The form 1139The form
1134\begin{Produc} 1140\begin{Produc}
1135\produc{functioncall}{prefixexp \ter{:} \Nter{name} args} 1141\produc{functioncall}{prefixexp \ter{:} \Nter{name} args}
1136\end{Produc}% 1142\end{Produc}
1137can be used to call ``methods''. 1143can be used to call \Q{methods}.
1138A call \verb|v:name(...)| 1144A call \verb|v:name(...)|
1139is syntactic sugar for \verb|v.name(v, ...)|, 1145is syntactic sugar for \verb|v.name(v, ...)|,
1140except that \verb|v| is evaluated only once. 1146except that \verb|v| is evaluated only once.
@@ -1144,7 +1150,7 @@ Arguments have the following syntax:
1144\produc{args}{\ter{(} \opt{explist1} \ter{)}} 1150\produc{args}{\ter{(} \opt{explist1} \ter{)}}
1145\produc{args}{tableconstructor} 1151\produc{args}{tableconstructor}
1146\produc{args}{Literal} 1152\produc{args}{Literal}
1147\end{Produc}% 1153\end{Produc}
1148All argument expressions are evaluated before the call. 1154All argument expressions are evaluated before the call.
1149A call of the form \verb|f{...}| is syntactic sugar for 1155A call of the form \verb|f{...}| is syntactic sugar for
1150\verb|f({...})|, that is, 1156\verb|f({...})|, that is,
@@ -1209,14 +1215,14 @@ The syntax for function definition is\IndexKW{function}
1209\begin{Produc} 1215\begin{Produc}
1210\produc{function}{\rwd{function} funcbody} 1216\produc{function}{\rwd{function} funcbody}
1211\produc{funcbody}{\ter{(} \opt{parlist1} \ter{)} block \rwd{end}} 1217\produc{funcbody}{\ter{(} \opt{parlist1} \ter{)} block \rwd{end}}
1212\end{Produc}% 1218\end{Produc}
1213 1219
1214The following syntactic sugar simplifies function definitions: 1220The following syntactic sugar simplifies function definitions:
1215\begin{Produc} 1221\begin{Produc}
1216\produc{stat}{\rwd{function} funcname funcbody} 1222\produc{stat}{\rwd{function} funcname funcbody}
1217\produc{stat}{\rwd{local} \rwd{function} \Nter{name} funcbody} 1223\produc{stat}{\rwd{local} \rwd{function} \Nter{name} funcbody}
1218\produc{funcname}{\Nter{name} \rep{\ter{.} \Nter{name}} \opt{\ter{:} \Nter{name}}} 1224\produc{funcname}{\Nter{name} \rep{\ter{.} \Nter{name}} \opt{\ter{:} \Nter{name}}}
1219\end{Produc}% 1225\end{Produc}
1220The statement 1226The statement
1221\begin{verbatim} 1227\begin{verbatim}
1222 function f () ... end 1228 function f () ... end
@@ -1259,8 +1265,8 @@ initialized with the argument values:
1259\begin{Produc} 1265\begin{Produc}
1260\produc{parlist1}{namelist \opt{\ter{,} \ter{\ldots}}} 1266\produc{parlist1}{namelist \opt{\ter{,} \ter{\ldots}}}
1261\produc{parlist1}{\ter{\ldots}} 1267\produc{parlist1}{\ter{\ldots}}
1262\end{Produc}% 1268\end{Produc}
1263\label{vararg}% 1269\label{vararg}
1264When a function is called, 1270When a function is called,
1265the list of \Index{arguments} is adjusted to 1271the list of \Index{arguments} is adjusted to
1266the length of the list of parameters, 1272the length of the list of parameters,
@@ -1338,7 +1344,7 @@ For instance:
1338\end{verbatim} 1344\end{verbatim}
1339Notice that, in a declaration like \verb|local x = x|, 1345Notice that, in a declaration like \verb|local x = x|,
1340the new \verb|x| being declared is not in scope yet, 1346the new \verb|x| being declared is not in scope yet,
1341so the second \verb|x| refers to the ``outside'' variable. 1347so the second \verb|x| refers to the \Q{outside} variable.
1342 1348
1343Because of these \Index{lexical scoping} rules, 1349Because of these \Index{lexical scoping} rules,
1344local variables can be freely accessed by functions 1350local variables can be freely accessed by functions
@@ -1353,7 +1359,7 @@ For instance:
1353\end{verbatim} 1359\end{verbatim}
1354 1360
1355Notice that each execution of a \rwd{local} statement 1361Notice that each execution of a \rwd{local} statement
1356``creates'' new local variables. 1362\Q{creates} new local variables.
1357Consider the following example: 1363Consider the following example:
1358\begin{verbatim} 1364\begin{verbatim}
1359 a = {} 1365 a = {}
@@ -1403,14 +1409,14 @@ Metatables control the operations listed next.
1403Each operation is identified by its corresponding name. 1409Each operation is identified by its corresponding name.
1404The key for each operation is a string with its name prefixed by 1410The key for each operation is a string with its name prefixed by
1405two underscores; 1411two underscores;
1406for instance, the key for operation ``add'' is the 1412for instance, the key for operation \Q{add} is the
1407string \verb|"__add"|. 1413string \verb|"__add"|.
1408The semantics of these operations is better explained by a Lua function 1414The semantics of these operations is better explained by a Lua function
1409describing how the interpreter executes that operation. 1415describing how the interpreter executes that operation.
1410%Each function shows how a handler is called, 1416\C{Each function shows how a handler is called,}
1411%its arguments (that is, its signature), 1417\C{its arguments (that is, its signature),}
1412%its results, 1418\C{its results,}
1413%and the default behavior in the absence of a handler. 1419\C{and the default behavior in the absence of a handler.}
1414The code shown here in Lua is only illustrative; 1420The code shown here in Lua is only illustrative;
1415the real behavior is hard coded in the interpreter, 1421the real behavior is hard coded in the interpreter,
1416and it is much more efficient than this simulation. 1422and it is much more efficient than this simulation.
@@ -1420,7 +1426,7 @@ are described in \See{predefined}.
1420 1426
1421\begin{description} 1427\begin{description}
1422 1428
1423\item[``add'':]\IndexTM{add} 1429\item[\Q{add}:]\IndexTM{add}
1424the \verb|+| operation. 1430the \verb|+| operation.
1425 1431
1426The function \verb|getbinhandler| below defines how Lua chooses a handler 1432The function \verb|getbinhandler| below defines how Lua chooses a handler
@@ -1434,7 +1440,7 @@ then Lua tries the second operand.
1434 end 1440 end
1435\end{verbatim} 1441\end{verbatim}
1436Using that function, 1442Using that function,
1437the behavior of the ``add'' operation is 1443the behavior of the \Q{add} operation is
1438\begin{verbatim} 1444\begin{verbatim}
1439 function add_event (op1, op2) 1445 function add_event (op1, op2)
1440 local o1, o2 = tonumber(op1), tonumber(op2) 1446 local o1, o2 = tonumber(op1), tonumber(op2)
@@ -1452,19 +1458,19 @@ the behavior of the ``add'' operation is
1452 end 1458 end
1453\end{verbatim} 1459\end{verbatim}
1454 1460
1455\item[``sub'':]\IndexTM{sub} 1461\item[\Q{sub}:]\IndexTM{sub}
1456the \verb|-| operation. 1462the \verb|-| operation.
1457Behavior similar to the ``add'' operation. 1463Behavior similar to the \Q{add} operation.
1458 1464
1459\item[``mul'':]\IndexTM{mul} 1465\item[\Q{mul}:]\IndexTM{mul}
1460the \verb|*| operation. 1466the \verb|*| operation.
1461Behavior similar to the ``add'' operation. 1467Behavior similar to the \Q{add} operation.
1462 1468
1463\item[``div'':]\IndexTM{div} 1469\item[\Q{div}:]\IndexTM{div}
1464the \verb|/| operation. 1470the \verb|/| operation.
1465Behavior similar to the ``add'' operation. 1471Behavior similar to the \Q{add} operation.
1466 1472
1467\item[``pow'':]\IndexTM{pow} 1473\item[\Q{pow}:]\IndexTM{pow}
1468the \verb|^| operation (exponentiation) operation. 1474the \verb|^| operation (exponentiation) operation.
1469\begin{verbatim} ?? 1475\begin{verbatim} ??
1470 function pow_event (op1, op2) 1476 function pow_event (op1, op2)
@@ -1478,7 +1484,7 @@ the \verb|^| operation (exponentiation) operation.
1478 end 1484 end
1479\end{verbatim} 1485\end{verbatim}
1480 1486
1481\item[``unm'':]\IndexTM{unm} 1487\item[\Q{unm}:]\IndexTM{unm}
1482the unary \verb|-| operation. 1488the unary \verb|-| operation.
1483\begin{verbatim} 1489\begin{verbatim}
1484 function unm_event (op) 1490 function unm_event (op)
@@ -1498,7 +1504,7 @@ the unary \verb|-| operation.
1498 end 1504 end
1499\end{verbatim} 1505\end{verbatim}
1500 1506
1501\item[``lt'':]\IndexTM{lt} 1507\item[\Q{lt}:]\IndexTM{lt}
1502the \verb|<| operation. 1508the \verb|<| operation.
1503\begin{verbatim} 1509\begin{verbatim}
1504 function lt_event (op1, op2) 1510 function lt_event (op1, op2)
@@ -1518,7 +1524,7 @@ the \verb|<| operation.
1518\end{verbatim} 1524\end{verbatim}
1519\verb|a>b| is equivalent to \verb|b<a|. 1525\verb|a>b| is equivalent to \verb|b<a|.
1520 1526
1521\item[``le'':]\IndexTM{lt} 1527\item[\Q{le}:]\IndexTM{lt}
1522the \verb|<=| operation. 1528the \verb|<=| operation.
1523\begin{verbatim} 1529\begin{verbatim}
1524 function le_event (op1, op2) 1530 function le_event (op1, op2)
@@ -1542,12 +1548,12 @@ the \verb|<=| operation.
1542 end 1548 end
1543\end{verbatim} 1549\end{verbatim}
1544\verb|a>=b| is equivalent to \verb|b<=a|. 1550\verb|a>=b| is equivalent to \verb|b<=a|.
1545Notice that, in the absence of a ``le'' metamethod, 1551Notice that, in the absence of a \Q{le} metamethod,
1546Lua tries the ``lt'', assuming that \verb|a<=b| is 1552Lua tries the \Q{lt}, assuming that \verb|a<=b| is
1547equivalent to \verb|not (b<a)|. 1553equivalent to \verb|not (b<a)|.
1548 1554
1549 1555
1550\item[``concat'':]\IndexTM{concatenation} 1556\item[\Q{concat}:]\IndexTM{concatenation}
1551the \verb|..| (concatenation) operation. 1557the \verb|..| (concatenation) operation.
1552\begin{verbatim} 1558\begin{verbatim}
1553 function concat_event (op1, op2) 1559 function concat_event (op1, op2)
@@ -1565,8 +1571,8 @@ the \verb|..| (concatenation) operation.
1565 end 1571 end
1566\end{verbatim} 1572\end{verbatim}
1567 1573
1568\item[``index'':]\IndexTM{index} 1574\item[\Q{index}:]\IndexTM{index}
1569The ``gettable'' operation \verb|table[key]|. 1575The \Q{gettable} operation \verb|table[key]|.
1570\begin{verbatim} 1576\begin{verbatim}
1571 function gettable_event (table, key) 1577 function gettable_event (table, key)
1572 local h 1578 local h
@@ -1587,8 +1593,8 @@ The ``gettable'' operation \verb|table[key]|.
1587 end 1593 end
1588\end{verbatim} 1594\end{verbatim}
1589 1595
1590\item[``newindex'':]\IndexTM{index} 1596\item[\Q{newindex}:]\IndexTM{index}
1591The ``settable'' operation \verb|table[key] = value|. 1597The \Q{settable} operation \verb|table[key] = value|.
1592\begin{verbatim} 1598\begin{verbatim}
1593 function settable_event (table, key, value) 1599 function settable_event (table, key, value)
1594 local h 1600 local h
@@ -1610,7 +1616,7 @@ The ``settable'' operation \verb|table[key] = value|.
1610\end{verbatim} 1616\end{verbatim}
1611 1617
1612 1618
1613\item[``call'':]\IndexTM{call} 1619\item[\Q{call}:]\IndexTM{call}
1614called when Lua calls a value. 1620called when Lua calls a value.
1615\begin{verbatim} 1621\begin{verbatim}
1616 function function_event (func, ...) 1622 function function_event (func, ...)
@@ -1659,7 +1665,7 @@ Lua supports coroutines,
1659also called \emph{semi-coroutines} 1665also called \emph{semi-coroutines}
1660or \emph{collaborative multithreading}. 1666or \emph{collaborative multithreading}.
1661A coroutine in Lua represents an independent thread of execution. 1667A coroutine in Lua represents an independent thread of execution.
1662Unlike ``real'' threads, however, 1668Unlike \Q{real} threads, however,
1663a coroutine only suspends its execution by explicitly calling 1669a coroutine only suspends its execution by explicitly calling
1664an yield function. 1670an yield function.
1665 1671
@@ -1753,7 +1759,7 @@ main false cannot resume dead coroutine
1753 1759
1754 1760
1755 1761
1756%------------------------------------------------------------------------------ 1762\C{------------------------------------------------------------------------------}
1757\section{The Application Program Interface}\label{API} 1763\section{The Application Program Interface}\label{API}
1758\index{C API} 1764\index{C API}
1759 1765
@@ -1764,7 +1770,7 @@ All API functions and related types and constants
1764are declared in the header file \verb|lua.h|. 1770are declared in the header file \verb|lua.h|.
1765 1771
1766\NOTE 1772\NOTE
1767Even when we use the term ``function'', 1773Even when we use the term \Q{function},
1768any facility in the API may be provided as a \emph{macro} instead. 1774any facility in the API may be provided as a \emph{macro} instead.
1769All such macros use each of its arguments exactly once 1775All such macros use each of its arguments exactly once
1770(except for the first argument, which is always a Lua state), 1776(except for the first argument, which is always a Lua state),
@@ -1801,8 +1807,8 @@ and frees all dynamic memory used by that state.
1801On several platforms, you may not need to call this function, 1807On several platforms, you may not need to call this function,
1802because all resources are naturally released when the host program ends. 1808because all resources are naturally released when the host program ends.
1803On the other hand, 1809On the other hand,
1804long-running programs --- 1810long-running programs \Em{}
1805like a daemon or a web server --- 1811like a daemon or a web server \Em{}
1806might need to release states as soon as they are not needed, 1812might need to release states as soon as they are not needed,
1807to avoid growing too large. 1813to avoid growing too large.
1808 1814
@@ -1813,7 +1819,7 @@ Lua offers partial support for multiple threads of execution.
1813If you have a C~library that offers multi-threading, 1819If you have a C~library that offers multi-threading,
1814then Lua can cooperate with it to implement the equivalent facility in Lua. 1820then Lua can cooperate with it to implement the equivalent facility in Lua.
1815Also, Lua implements its own coroutine system on top of threads. 1821Also, Lua implements its own coroutine system on top of threads.
1816The following function creates a new ``thread'' in Lua: 1822The following function creates a new \Q{thread} in Lua:
1817\begin{verbatim} 1823\begin{verbatim}
1818 lua_State *lua_newthread (lua_State *L); 1824 lua_State *lua_newthread (lua_State *L);
1819\end{verbatim} 1825\end{verbatim}
@@ -1821,7 +1827,7 @@ The following function creates a new ``thread'' in Lua:
1821The new state returned by this function shares with the original state 1827The new state returned by this function shares with the original state
1822all global environment (such as tables), 1828all global environment (such as tables),
1823but has an independent run-time stack. 1829but has an independent run-time stack.
1824(The use of these multiple stacks must be ``synchronized'' with C. 1830(The use of these multiple stacks must be \Q{synchronized} with C.
1825How to explain that? TO BE WRITTEN.) 1831How to explain that? TO BE WRITTEN.)
1826 1832
1827Each thread has an independent table for global variables. 1833Each thread has an independent table for global variables.
@@ -1997,7 +2003,7 @@ These functions can be called with any acceptable index.
1997 2003
1998\verb|lua_type| returns the type of a value in the stack, 2004\verb|lua_type| returns the type of a value in the stack,
1999or \verb|LUA_TNONE| for a non-valid index 2005or \verb|LUA_TNONE| for a non-valid index
2000(that is, if that stack position is ``empty''). 2006(that is, if that stack position is \Q{empty}).
2001The types are coded by the following constants 2007The types are coded by the following constants
2002defined in \verb|lua.h|: 2008defined in \verb|lua.h|:
2003\verb|LUA_TNIL|, 2009\verb|LUA_TNIL|,
@@ -2061,7 +2067,7 @@ When called with a non-valid index,
2061they act as if the given value had an incorrect type. 2067they act as if the given value had an incorrect type.
2062 2068
2063\verb|lua_toboolean| converts the Lua value at the given index 2069\verb|lua_toboolean| converts the Lua value at the given index
2064to a C ``boolean'' value (that is, 0 or 1). 2070to a C \Q{boolean} value (that is, 0 or 1).
2065Like all tests in Lua, it returns 1 for any Lua value different from 2071Like all tests in Lua, it returns 1 for any Lua value different from
2066\False{} and \nil; 2072\False{} and \nil;
2067otherwise it returns 0. 2073otherwise it returns 0.
@@ -2132,7 +2138,7 @@ make an internal copy of the given string.
2132otherwise, you should use the more general \verb|lua_pushlstring|, 2138otherwise, you should use the more general \verb|lua_pushlstring|,
2133which accepts an explicit size. 2139which accepts an explicit size.
2134 2140
2135You can also push ``formatted'' strings: 2141You can also push \Q{formatted} strings:
2136\begin{verbatim} 2142\begin{verbatim}
2137 const char *lua_pushfstring (lua_State *L, const char *fmt, ...); 2143 const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
2138 const char *lua_pushvfstring (lua_State *L, const char *fmt, 2144 const char *lua_pushvfstring (lua_State *L, const char *fmt,
@@ -2191,11 +2197,11 @@ In particular
2191After the collection, 2197After the collection,
2192a new threshold is set according to the previous rule. 2198a new threshold is set according to the previous rule.
2193 2199
2194%% TODO do we need a new way to do that?? 2200\C{TODO do we need a new way to do that??}
2195% If you want to change the adaptive behavior of the garbage collector, 2201\C{ If you want to change the adaptive behavior of the garbage collector,}
2196% you can use the garbage-collection tag method for \nil{} % 2202\C{ you can use the garbage-collection tag method for \nil{} }
2197% to set your own threshold 2203\C{ to set your own threshold}
2198% (the tag method is called after Lua resets the threshold). 2204\C{ (the tag method is called after Lua resets the threshold).}
2199 2205
2200 2206
2201\subsection{Userdata}\label{userdata} 2207\subsection{Userdata}\label{userdata}
@@ -2214,7 +2220,7 @@ A light userdata represents a pointer.
2214It is a value (like a number): 2220It is a value (like a number):
2215You do not create it, it has no metatables, 2221You do not create it, it has no metatables,
2216it is not collected (as it was never created). 2222it is not collected (as it was never created).
2217A light userdata is equal to ``any'' 2223A light userdata is equal to \Q{any}
2218light userdata with the same address. 2224light userdata with the same address.
2219 2225
2220In Lua code, there is no way to test whether a userdata is full or light; 2226In Lua code, there is no way to test whether a userdata is full or light;
@@ -2278,10 +2284,10 @@ You can load a Lua chunk with
2278\DefAPI{Chunkreader}\DefAPI{lua_load} 2284\DefAPI{Chunkreader}\DefAPI{lua_load}
2279The return values of \verb|lua_load| are: 2285The return values of \verb|lua_load| are:
2280\begin{itemize} 2286\begin{itemize}
2281\item 0 --- no errors; 2287\item 0 \Em{} no errors;
2282\item \IndexAPI{LUA_ERRSYNTAX} --- 2288\item \IndexAPI{LUA_ERRSYNTAX} \Em{}
2283syntax error during pre-compilation. 2289syntax error during pre-compilation.
2284\item \IndexAPI{LUA_ERRMEM} --- 2290\item \IndexAPI{LUA_ERRMEM} \Em{}
2285memory allocation error. 2291memory allocation error.
2286\end{itemize} 2292\end{itemize}
2287If there are no errors, 2293If there are no errors,
@@ -2337,7 +2343,7 @@ The table is left where it was in the stack;
2337this is convenient for getting multiple values from a table. 2343this is convenient for getting multiple values from a table.
2338 2344
2339As in Lua, this function may trigger a metamethod 2345As in Lua, this function may trigger a metamethod
2340for the ``index'' event \see{metatable}. 2346for the \Q{index} event \see{metatable}.
2341To get the real value of any table key, 2347To get the real value of any table key,
2342without invoking any metamethod, 2348without invoking any metamethod,
2343use the \emph{raw} version: 2349use the \emph{raw} version:
@@ -2360,7 +2366,7 @@ The table is left where it was in the stack;
2360this is convenient for setting multiple values in a table. 2366this is convenient for setting multiple values in a table.
2361 2367
2362As in Lua, this operation may trigger a metamethod 2368As in Lua, this operation may trigger a metamethod
2363for the ``settable'' or ``newindex'' events. 2369for the \Q{settable} or \Q{newindex} events.
2364To set the real value of any table index, 2370To set the real value of any table index,
2365without invoking any metamethod, 2371without invoking any metamethod,
2366use the \emph{raw} version: 2372use the \emph{raw} version:
@@ -2377,7 +2383,7 @@ You can traverse a table with the function
2377where \verb|index| points to the table to be traversed. 2383where \verb|index| points to the table to be traversed.
2378The function pops a key from the stack, 2384The function pops a key from the stack,
2379and pushes a key-value pair from the table 2385and pushes a key-value pair from the table
2380(the ``next'' pair after the given key). 2386(the \Q{next} pair after the given key).
2381If there are no more elements, then \verb|lua_next| returns 0 2387If there are no more elements, then \verb|lua_next| returns 0
2382(and pushes nothing). 2388(and pushes nothing).
2383Use a \nil{} key to signal the start of a traversal. 2389Use a \nil{} key to signal the start of a traversal.
@@ -2480,7 +2486,7 @@ Here it is in~C:
2480 lua_settable(L, LUA_GLOBALSINDEX); /* set global variable `a' */ 2486 lua_settable(L, LUA_GLOBALSINDEX); /* set global variable `a' */
2481 lua_pop(L, 1); /* remove `t' from the stack */ 2487 lua_pop(L, 1); /* remove `t' from the stack */
2482\end{verbatim} 2488\end{verbatim}
2483Notice that the code above is ``balanced'': 2489Notice that the code above is \Q{balanced}:
2484at its end, the stack is back to its original configuration. 2490at its end, the stack is back to its original configuration.
2485This is considered good programming practice. 2491This is considered good programming practice.
2486 2492
@@ -2530,10 +2536,10 @@ The \verb|lua_pcall| function returns 0 in case of success,
2530or one of the following error codes 2536or one of the following error codes
2531(defined in \verb|lua.h|): 2537(defined in \verb|lua.h|):
2532\begin{itemize} 2538\begin{itemize}
2533\item \IndexAPI{LUA_ERRRUN} --- a runtime error. 2539\item \IndexAPI{LUA_ERRRUN} \Em{} a runtime error.
2534\item \IndexAPI{LUA_ERRMEM} --- memory allocation error. 2540\item \IndexAPI{LUA_ERRMEM} \Em{} memory allocation error.
2535For such errors, Lua does not call the error handler function. 2541For such errors, Lua does not call the error handler function.
2536\item \IndexAPI{LUA_ERRERR} --- 2542\item \IndexAPI{LUA_ERRERR} \Em{}
2537error while running the error handler function. 2543error while running the error handler function.
2538\end{itemize} 2544\end{itemize}
2539 2545
@@ -2541,7 +2547,7 @@ error while running the error handler function.
2541\medskip 2547\medskip
2542 2548
2543>>>> 2549>>>>
2544%% TODO: mover essas 2 para algum lugar melhor. 2550\C{ TODO: mover essas 2 para algum lugar melhor.}
2545Some special Lua functions have their own C~interfaces. 2551Some special Lua functions have their own C~interfaces.
2546The host program can generate a Lua error calling the function 2552The host program can generate a Lua error calling the function
2547\begin{verbatim} 2553\begin{verbatim}
@@ -2557,7 +2563,7 @@ then the corresponding Lua execution terminates,
2557as if an error had occurred inside Lua code. 2563as if an error had occurred inside Lua code.
2558Otherwise, the whole host program terminates with a call to 2564Otherwise, the whole host program terminates with a call to
2559\verb|exit(EXIT_FAILURE)|. 2565\verb|exit(EXIT_FAILURE)|.
2560%% TODO: at_panic 2566\C{ TODO: at_panic}
2561 2567
2562The function 2568The function
2563\begin{verbatim} 2569\begin{verbatim}
@@ -2690,7 +2696,7 @@ implemented by the auxiliary library,
2690and therefore should not be used by other purposes. 2696and therefore should not be used by other purposes.
2691 2697
2692 2698
2693%------------------------------------------------------------------------------ 2699\C{------------------------------------------------------------------------------}
2694\section{The Debug Interface} \label{debugI} 2700\section{The Debug Interface} \label{debugI}
2695 2701
2696Lua has no built-in debugging facilities. 2702Lua has no built-in debugging facilities.
@@ -2698,7 +2704,7 @@ Instead, it offers a special interface
2698by means of functions and \emph{hooks}. 2704by means of functions and \emph{hooks}.
2699This interface allows the construction of different 2705This interface allows the construction of different
2700kinds of debuggers, profilers, and other tools 2706kinds of debuggers, profilers, and other tools
2701that need ``inside information'' from the interpreter. 2707that need \Q{inside information} from the interpreter.
2702 2708
2703\subsection{Stack and Function Information} 2709\subsection{Stack and Function Information}
2704 2710
@@ -2778,7 +2784,7 @@ if the function was defined in a file,
2778then \verb|source| starts with a \verb|@| followed by the file name. 2784then \verb|source| starts with a \verb|@| followed by the file name.
2779 2785
2780\item[short\_src] 2786\item[short\_src]
2781A ``printable'' version of \verb|source|, to be used in error messages. 2787A \Q{printable} version of \verb|source|, to be used in error messages.
2782 2788
2783\item[linedefined] 2789\item[linedefined]
2784the line number where the definition of the function starts. 2790the line number where the definition of the function starts.
@@ -2869,7 +2875,7 @@ A hook may be called in four different events:
2869a \emph{call} event, when Lua calls a function; 2875a \emph{call} event, when Lua calls a function;
2870a \emph{return} event, when Lua returns from a function; 2876a \emph{return} event, when Lua returns from a function;
2871a \emph{line} event, when Lua starts executing a new line of code; 2877a \emph{line} event, when Lua starts executing a new line of code;
2872and a \emph{count} event, which happens every ``count'' instructions. 2878and a \emph{count} event, which happens every \Q{count} instructions.
2873Lua identifies them with the following constants: 2879Lua identifies them with the following constants:
2874\verb|LUA_HOOKCALL|\DefAPI{LUA_HOOKCALL}, 2880\verb|LUA_HOOKCALL|\DefAPI{LUA_HOOKCALL},
2875\verb|LUA_HOOKRET|\DefAPI{LUA_HOOKRET}, 2881\verb|LUA_HOOKRET|\DefAPI{LUA_HOOKRET},
@@ -2896,9 +2902,9 @@ plus the macro \verb|LUA_MASKCOUNT(count)|.
2896For each event, the hook is called as explained below: 2902For each event, the hook is called as explained below:
2897\begin{description} 2903\begin{description}
2898\item{The call hook} is called when the interpreter calls a function. 2904\item{The call hook} is called when the interpreter calls a function.
2899The hook is called just after Lua ``enters'' the new function. 2905The hook is called just after Lua \Q{enters} the new function.
2900\item{The return hook} is called when the interpreter returns from a function. 2906\item{The return hook} is called when the interpreter returns from a function.
2901The hook is called just before Lua ``leaves'' the function. 2907The hook is called just before Lua \Q{leaves} the function.
2902\item{The line hook} is called when the interpreter is about to 2908\item{The line hook} is called when the interpreter is about to
2903start the execution of a new line of code, 2909start the execution of a new line of code,
2904or when it jumps back (even for the same line). 2910or when it jumps back (even for the same line).
@@ -2930,14 +2936,14 @@ Therefore, if a hook calls Lua to execute a function or a chunk,
2930that execution occurs without any calls to hooks. 2936that execution occurs without any calls to hooks.
2931 2937
2932 2938
2933%------------------------------------------------------------------------------ 2939\C{------------------------------------------------------------------------------}
2934\section{Standard Libraries}\label{libraries} 2940\section{Standard Libraries}\label{libraries}
2935 2941
2936The standard libraries provide useful functions 2942The standard libraries provide useful functions
2937that are implemented directly through the standard C~API. 2943that are implemented directly through the standard C~API.
2938Some of these functions provide essential services to the language 2944Some of these functions provide essential services to the language
2939(e.g. \verb|type| and \verb|getmetatable|); 2945(e.g. \verb|type| and \verb|getmetatable|);
2940others provide access to ``outside'' services (e.g. I/O); 2946others provide access to \Q{outside} services (e.g. I/O);
2941and others could be implemented in Lua itself, 2947and others could be implemented in Lua itself,
2942but are quite useful or have critical performance to 2948but are quite useful or have critical performance to
2943deserve an implementation in C (e.g. \verb|sort|). 2949deserve an implementation in C (e.g. \verb|sort|).
@@ -2987,8 +2993,8 @@ with a string containing the current interpreter version.
2987The current content of this string is {\tt "Lua \Version"}. 2993The current content of this string is {\tt "Lua \Version"}.
2988 2994
2989\subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert} 2995\subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert}
2990Issues an \emph{``assertion failed!''} error 2996Issues an \emph{\Q{assertion failed!}} error
2991when its argument \verb|v| is \nil{} or \false; 2997when its argument \verb|v| is \nil{} or \False;
2992otherwise, returns this argument. 2998otherwise, returns this argument.
2993This function is equivalent to the following Lua function: 2999This function is equivalent to the following Lua function:
2994\begin{verbatim} 3000\begin{verbatim}
@@ -3035,7 +3041,7 @@ Returns the current table of globals in use by the function.
3035which specifies the function at that stack level: 3041which specifies the function at that stack level:
3036Level 1 is the function calling \verb|getglobals|. 3042Level 1 is the function calling \verb|getglobals|.
3037If the given function is not a Lua function, 3043If the given function is not a Lua function,
3038returns the ``global'' table of globals. 3044returns the \Q{global} table of globals.
3039The default for \verb|function| is 1. 3045The default for \verb|function| is 1.
3040 3046
3041\subsubsection*{\ff \T{getmetatable (object)}} 3047\subsubsection*{\ff \T{getmetatable (object)}}
@@ -3072,7 +3078,7 @@ returns the compiled chunk as a function;
3072otherwise, returns \nil{} plus an error message. 3078otherwise, returns \nil{} plus an error message.
3073 3079
3074The optional parameter \verb|chunkname| 3080The optional parameter \verb|chunkname|
3075is the ``name of the chunk'', 3081is the \Q{name of the chunk},
3076which is used in error messages and debug information. 3082which is used in error messages and debug information.
3077 3083
3078To load and run a given string, use the idiom 3084To load and run a given string, use the idiom
@@ -3113,7 +3119,7 @@ so that the construction
3113\begin{verbatim} 3119\begin{verbatim}
3114 for k,v in pairs(t) do ... end 3120 for k,v in pairs(t) do ... end
3115\end{verbatim} 3121\end{verbatim}
3116will iterate over all pairs of key--value of table \verb|t|. 3122will iterate over all pairs of key\En{}value of table \verb|t|.
3117 3123
3118\subsubsection*{\ff \T{pcall (func, arg1, arg2, ...)}}\DefLIB{pcall} 3124\subsubsection*{\ff \T{pcall (func, arg1, arg2, ...)}}\DefLIB{pcall}
3119\label{pdf-pcall} 3125\label{pdf-pcall}
@@ -3285,8 +3291,8 @@ where to start the search;
3285its default value is~1, and may be negative. 3291its default value is~1, and may be negative.
3286A value of \True{} as a fourth, optional argument \verb|plain| 3292A value of \True{} as a fourth, optional argument \verb|plain|
3287turns off the pattern matching facilities, 3293turns off the pattern matching facilities,
3288so the function does a plain ``find substring'' operation, 3294so the function does a plain \Q{find substring} operation,
3289with no characters in \verb|pattern| being considered ``magic''. 3295with no characters in \verb|pattern| being considered \Q{magic}.
3290Note that if \verb|plain| is given, then \verb|init| must be given too. 3296Note that if \verb|plain| is given, then \verb|init| must be given too.
3291 3297
3292\subsubsection*{\ff \T{string.len (s)}}\DefLIB{string.len} 3298\subsubsection*{\ff \T{string.len (s)}}\DefLIB{string.len}
@@ -3451,26 +3457,26 @@ The following combinations are allowed in describing a character class:
3451\begin{description}\leftskip=20pt 3457\begin{description}\leftskip=20pt
3452\item[\emph{x}] (where \emph{x} is not one of the magic characters 3458\item[\emph{x}] (where \emph{x} is not one of the magic characters
3453\verb|^$()%.[]*+-?|) 3459\verb|^$()%.[]*+-?|)
3454--- represents the character \emph{x} itself. 3460\Em{} represents the character \emph{x} itself.
3455\item[\T{.}] --- (a dot) represents all characters. 3461\item[\T{.}] \Em{} (a dot) represents all characters.
3456\item[\T{\%a}] --- represents all letters. 3462\item[\T{\%a}] \Em{} represents all letters.
3457\item[\T{\%c}] --- represents all control characters. 3463\item[\T{\%c}] \Em{} represents all control characters.
3458\item[\T{\%d}] --- represents all digits. 3464\item[\T{\%d}] \Em{} represents all digits.
3459\item[\T{\%l}] --- represents all lowercase letters. 3465\item[\T{\%l}] \Em{} represents all lowercase letters.
3460\item[\T{\%p}] --- represents all punctuation characters. 3466\item[\T{\%p}] \Em{} represents all punctuation characters.
3461\item[\T{\%s}] --- represents all space characters. 3467\item[\T{\%s}] \Em{} represents all space characters.
3462\item[\T{\%u}] --- represents all uppercase letters. 3468\item[\T{\%u}] \Em{} represents all uppercase letters.
3463\item[\T{\%w}] --- represents all alphanumeric characters. 3469\item[\T{\%w}] \Em{} represents all alphanumeric characters.
3464\item[\T{\%x}] --- represents all hexadecimal digits. 3470\item[\T{\%x}] \Em{} represents all hexadecimal digits.
3465\item[\T{\%z}] --- represents the character with representation 0. 3471\item[\T{\%z}] \Em{} represents the character with representation 0.
3466\item[\T{\%\M{x}}] (where \M{x} is any non-alphanumeric character) --- 3472\item[\T{\%\M{x}}] (where \M{x} is any non-alphanumeric character) \Em{}
3467represents the character \M{x}. 3473represents the character \M{x}.
3468This is the standard way to escape the magic characters. 3474This is the standard way to escape the magic characters.
3469We recommend that any punctuation character (even the non magic) 3475We recommend that any punctuation character (even the non magic)
3470should be preceded by a \verb|%| 3476should be preceded by a \verb|%|
3471when used to represent itself in a pattern. 3477when used to represent itself in a pattern.
3472 3478
3473\item[\T{[\M{set}]}] --- 3479\item[\T{[\M{set}]}] \Em{}
3474represents the class which is the union of all 3480represents the class which is the union of all
3475characters in \M{set}. 3481characters in \M{set}.
3476A range of characters may be specified by 3482A range of characters may be specified by
@@ -3488,7 +3494,7 @@ The interaction between ranges and classes is not defined.
3488Therefore, patterns like \verb|[%a-z]| or \verb|[a-%%]| 3494Therefore, patterns like \verb|[%a-z]| or \verb|[a-%%]|
3489have no meaning. 3495have no meaning.
3490 3496
3491\item[\T{[\^\null\M{set}]}] --- 3497\item[\T{[\^\null\M{set}]}] \Em{}
3492represents the complement of \M{set}, 3498represents the complement of \M{set},
3493where \M{set} is interpreted as above. 3499where \M{set} is interpreted as above.
3494\end{description} 3500\end{description}
@@ -3576,13 +3582,13 @@ represents an array or a list.
3576For those functions, an important concept is the \emph{size} of the array. 3582For those functions, an important concept is the \emph{size} of the array.
3577There are three ways to specify that size: 3583There are three ways to specify that size:
3578\begin{itemize} 3584\begin{itemize}
3579\item the field \verb|"n"| --- 3585\item the field \verb|"n"| \Em{}
3580When the table has a field \verb|"n"| with a numerical value, 3586When the table has a field \verb|"n"| with a numerical value,
3581that value is assumed as its size. 3587that value is assumed as its size.
3582\item \verb|setn| --- 3588\item \verb|setn| \Em{}
3583You can call the \verb|table.setn| function to explicitly set 3589You can call the \verb|table.setn| function to explicitly set
3584the size of a table. 3590the size of a table.
3585\item implicit size --- 3591\item implicit size \Em{}
3586Otherwise, the size of the object is one less the first integer index 3592Otherwise, the size of the object is one less the first integer index
3587with a \nil{} value. 3593with a \nil{} value.
3588\end{itemize} 3594\end{itemize}
@@ -3622,13 +3628,13 @@ then the loop is broken, and this value is returned
3622as the final value of \verb|foreachi|. 3628as the final value of \verb|foreachi|.
3623 3629
3624\subsubsection*{\ff \T{table.getn (table)}}\DefLIB{table.getn}\label{getn} 3630\subsubsection*{\ff \T{table.getn (table)}}\DefLIB{table.getn}\label{getn}
3625Returns the ``size'' of a table, when seen as a list. 3631Returns the \Q{size} of a table, when seen as a list.
3626If the table has an \verb|n| field with a numeric value, 3632If the table has an \verb|n| field with a numeric value,
3627this value is the ``size'' of the table. 3633this value is the \Q{size} of the table.
3628Otherwise, if there was a previous call to 3634Otherwise, if there was a previous call to
3629\verb|table.getn| or to \verb|table.setn| over this table, 3635\verb|table.getn| or to \verb|table.setn| over this table,
3630the respective value is returned. 3636the respective value is returned.
3631Otherwise, the ``size'' is one less the first integer index with 3637Otherwise, the \Q{size} is one less the first integer index with
3632a \nil{} value. 3638a \nil{} value.
3633 3639
3634Notice that the last option happens only once for a table. 3640Notice that the last option happens only once for a table.
@@ -3679,7 +3685,7 @@ calling \verb|table.setn(table, n-1)|.
3679 3685
3680\subsubsection*{\ff \T{table.setn (table, n)}}\DefLIB{table.setn} 3686\subsubsection*{\ff \T{table.setn (table, n)}}\DefLIB{table.setn}
3681 3687
3682Updates the ``size'' of a table. 3688Updates the \Q{size} of a table.
3683If the table has a field \verb|"n"| with a numerical value, 3689If the table has a field \verb|"n"| with a numerical value,
3684that value is changed to the given \verb|n|. 3690that value is changed to the given \verb|n|.
3685Otherwise, it updates an internal state of the \verb|table| library 3691Otherwise, it updates an internal state of the \verb|table| library
@@ -3731,12 +3737,12 @@ are interfaces to the simple random generator functions
3731(No guarantees can be given for their statistical properties.) 3737(No guarantees can be given for their statistical properties.)
3732When called without arguments, 3738When called without arguments,
3733\verb|math.random| returns a pseudo-random real number 3739\verb|math.random| returns a pseudo-random real number
3734in the range \Math{[0,1)}. %] 3740in the range \Math{[0,1)}. \C{]}
3735When called with a number \Math{n}, 3741When called with a number \Math{n},
3736\verb|math.random| returns a pseudo-random integer in the range \Math{[1,n]}. 3742\verb|math.random| returns a pseudo-random integer in the range \Math{[1,n]}.
3737When called with two arguments, \Math{l} and \Math{u}, 3743When called with two arguments, \Math{l} and \Math{u},
3738\verb|math.random| returns a pseudo-random integer in the range \Math{[l,u]}. 3744\verb|math.random| returns a pseudo-random integer in the range \Math{[l,u]}.
3739The \verb|math.randomseed| function sets a ``seed'' 3745The \verb|math.randomseed| function sets a \Q{seed}
3740for the pseudo-random generator: 3746for the pseudo-random generator:
3741Equal seeds produce equal sequences of numbers. 3747Equal seeds produce equal sequences of numbers.
3742 3748
@@ -3817,12 +3823,12 @@ or, in case of errors, \nil{} plus an error message.
3817 3823
3818The \verb|mode| string can be any of the following: 3824The \verb|mode| string can be any of the following:
3819\begin{description}\leftskip=20pt 3825\begin{description}\leftskip=20pt
3820\item[``r''] read mode (the default); 3826\item[\Q{r}] read mode (the default);
3821\item[``w''] write mode; 3827\item[\Q{w}] write mode;
3822\item[``a''] append mode; 3828\item[\Q{a}] append mode;
3823\item[``r+''] update mode, all previous data is preserved; 3829\item[\Q{r+}] update mode, all previous data is preserved;
3824\item[``w+''] update mode, all previous data is erased; 3830\item[\Q{w+}] update mode, all previous data is erased;
3825\item[``a+''] append update mode, previous data is preserved, 3831\item[\Q{a+}] append update mode, previous data is preserved,
3826 writing is only allowed at the end of file. 3832 writing is only allowed at the end of file.
3827\end{description} 3833\end{description}
3828The \verb|mode| string may also have a \verb|b| at the end, 3834The \verb|mode| string may also have a \verb|b| at the end,
@@ -3883,11 +3889,11 @@ it uses a default format that reads the entire next line
3883 3889
3884The available formats are 3890The available formats are
3885\begin{description}\leftskip=20pt 3891\begin{description}\leftskip=20pt
3886\item[``*n''] reads a number; 3892\item[\Q{*n}] reads a number;
3887this is the only format that returns a number instead of a string. 3893this is the only format that returns a number instead of a string.
3888\item[``*a''] reads the whole file, starting at the current position. 3894\item[\Q{*a}] reads the whole file, starting at the current position.
3889On end of file, it returns the empty string. 3895On end of file, it returns the empty string.
3890\item[``*l''] reads the next line (skipping the end of line), 3896\item[\Q{*l}] reads the next line (skipping the end of line),
3891returning \nil{} on end of file. 3897returning \nil{} on end of file.
3892This is the default format. 3898This is the default format.
3893\item[\emph{number}] reads a string with up to that number of characters, 3899\item[\emph{number}] reads a string with up to that number of characters,
@@ -3904,9 +3910,9 @@ measured in bytes from the beginning of the file,
3904to the position given by \verb|offset| plus a base 3910to the position given by \verb|offset| plus a base
3905specified by the string \verb|whence|, as follows: 3911specified by the string \verb|whence|, as follows:
3906\begin{description}\leftskip=20pt 3912\begin{description}\leftskip=20pt
3907\item[``set''] base is position 0 (beginning of the file); 3913\item[\Q{set}] base is position 0 (beginning of the file);
3908\item[``cur''] base is current position; 3914\item[\Q{cur}] base is current position;
3909\item[``end''] base is end of file; 3915\item[\Q{end}] base is end of file;
3910\end{description} 3916\end{description}
3911In case of success, function \verb|seek| returns the final file position, 3917In case of success, function \verb|seek| returns the final file position,
3912measured in bytes from the beginning of the file. 3918measured in bytes from the beginning of the file.
@@ -4029,7 +4035,7 @@ and may have fields \verb|hour|, \verb|min|, \verb|sec|, and \verb|isdst|
4029 4035
4030The returned value is a number, whose meaning depends on your system. 4036The returned value is a number, whose meaning depends on your system.
4031In Posix, Windows, and some other systems, this number counts the number 4037In Posix, Windows, and some other systems, this number counts the number
4032of seconds since some given start time (the ``epoch''). 4038of seconds since some given start time (the \Q{epoch}).
4033In other systems, the meaning is not specified, 4039In other systems, the meaning is not specified,
4034and the number returned by \verb|time| can be used only as an argument to 4040and the number returned by \verb|time| can be used only as an argument to
4035\verb|date| and \verb|difftime|. 4041\verb|date| and \verb|difftime|.
@@ -4150,7 +4156,7 @@ the current hook function, the current hook mask,
4150and the current hook count (as set by the \verb|debug.sethook| function). 4156and the current hook count (as set by the \verb|debug.sethook| function).
4151 4157
4152 4158
4153%------------------------------------------------------------------------------ 4159\C{------------------------------------------------------------------------------}
4154\section{\Index{Lua Stand-alone}} \label{lua-sa} 4160\section{\Index{Lua Stand-alone}} \label{lua-sa}
4155 4161
4156Although Lua has been designed as an extension language, 4162Although Lua has been designed as an extension language,
@@ -4169,7 +4175,7 @@ The options are:
4169\begin{description}\leftskip=20pt 4175\begin{description}\leftskip=20pt
4170\item[\T{-} ] executes \verb|stdin| as a file; 4176\item[\T{-} ] executes \verb|stdin| as a file;
4171\item[\T{-e} \rm\emph{stat}] executes string \emph{stat}; 4177\item[\T{-e} \rm\emph{stat}] executes string \emph{stat};
4172\item[\T{-l} \rm\emph{file}] ``requires'' \emph{file}; 4178\item[\T{-l} \rm\emph{file}] \Q{requires} \emph{file};
4173\item[\T{-i}] enters interactive mode after running \emph{script}; 4179\item[\T{-i}] enters interactive mode after running \emph{script};
4174\item[\T{-v}] prints version information; 4180\item[\T{-v}] prints version information;
4175\item[\T{--}] stop handling options. 4181\item[\T{--}] stop handling options.
@@ -4248,7 +4254,7 @@ then
4248\end{verbatim} 4254\end{verbatim}
4249is a more portable solution.) 4255is a more portable solution.)
4250 4256
4251%------------------------------------------------------------------------------ 4257\C{------------------------------------------------------------------------------}
4252\section*{Acknowledgments} 4258\section*{Acknowledgments}
4253 4259
4254The Lua team is grateful to \tecgraf{} for its continued support to Lua. 4260The Lua team is grateful to \tecgraf{} for its continued support to Lua.
@@ -4368,7 +4374,9 @@ Userdata!!
4368 4374
4369\end{itemize} 4375\end{itemize}
4370 4376
4371%{=============================================================== 4377
4378
4379\C{[===============================================================}
4372\newpage 4380\newpage
4373\section*{The Complete Syntax of Lua} \label{BNF} 4381\section*{The Complete Syntax of Lua} \label{BNF}
4374\addcontentsline{toc}{section}{The Complete Syntax of Lua} 4382\addcontentsline{toc}{section}{The Complete Syntax of Lua}
@@ -4386,8 +4394,8 @@ enclosed in single quotes.
4386\renewenvironment{Produc}{\vspace{0.8ex}\par\noindent\hspace{3ex}\it\begin{tabular}{rrl}}{\end{tabular}\vspace{0.8ex}\par\noindent} 4394\renewenvironment{Produc}{\vspace{0.8ex}\par\noindent\hspace{3ex}\it\begin{tabular}{rrl}}{\end{tabular}\vspace{0.8ex}\par\noindent}
4387 4395
4388\renewcommand{\OrNL}{\\ & \Or & } 4396\renewcommand{\OrNL}{\\ & \Or & }
4389%\newcommand{\Nter}[1]{{\rm{\tt#1}}} 4397\C{\newcommand{\Nter}[1]{{\rm{\tt#1}}}}
4390%\newcommand{\Nter}[1]{\ter{#1}} 4398\C{\newcommand{\Nter}[1]{\ter{#1}}}
4391 4399
4392\index{grammar} 4400\index{grammar}
4393 4401
@@ -4397,7 +4405,7 @@ enclosed in single quotes.
4397 4405
4398\produc{block}{chunk} 4406\produc{block}{chunk}
4399 4407
4400\produc{stat}{% 4408\produc{stat}{
4401 varlist1 \ter{=} explist1 4409 varlist1 \ter{=} explist1
4402\OrNL functioncall 4410\OrNL functioncall
4403\OrNL \rwd{do} block \rwd{end} 4411\OrNL \rwd{do} block \rwd{end}
@@ -4422,7 +4430,7 @@ enclosed in single quotes.
4422 4430
4423\produc{varlist1}{var \rep{\ter{,} var}} 4431\produc{varlist1}{var \rep{\ter{,} var}}
4424 4432
4425\produc{var}{% 4433\produc{var}{
4426 \Nter{Name} 4434 \Nter{Name}
4427\Or prefixexp \ter{[} exp \ter{]} 4435\Or prefixexp \ter{[} exp \ter{]}
4428\Or prefixexp \ter{.} \Nter{Name} 4436\Or prefixexp \ter{.} \Nter{Name}
@@ -4434,7 +4442,7 @@ enclosed in single quotes.
4434 4442
4435\produc{explist1}{\rep{exp \ter{,}} exp} 4443\produc{explist1}{\rep{exp \ter{,}} exp}
4436 4444
4437\produc{exp}{% 4445\produc{exp}{
4438 \rwd{nil} 4446 \rwd{nil}
4439 \rwd{false} 4447 \rwd{false}
4440 \rwd{true} 4448 \rwd{true}
@@ -4449,12 +4457,12 @@ enclosed in single quotes.
4449 4457
4450\produc{prefixexp}{var \Or functioncall \Or \ter{(} exp \ter{)}} 4458\produc{prefixexp}{var \Or functioncall \Or \ter{(} exp \ter{)}}
4451 4459
4452\produc{functioncall}{% 4460\produc{functioncall}{
4453 prefixexp args 4461 prefixexp args
4454\Or prefixexp \ter{:} \Nter{Name} args 4462\Or prefixexp \ter{:} \Nter{Name} args
4455} 4463}
4456 4464
4457\produc{args}{% 4465\produc{args}{
4458 \ter{(} \opt{explist1} \ter{)} 4466 \ter{(} \opt{explist1} \ter{)}
4459\Or tableconstructor 4467\Or tableconstructor
4460\Or \Nter{Literal} 4468\Or \Nter{Literal}
@@ -4464,7 +4472,7 @@ enclosed in single quotes.
4464 4472
4465\produc{funcbody}{\ter{(} \opt{parlist1} \ter{)} block \rwd{end}} 4473\produc{funcbody}{\ter{(} \opt{parlist1} \ter{)} block \rwd{end}}
4466 4474
4467\produc{parlist1}{% 4475\produc{parlist1}{
4468 \Nter{Name} \rep{\ter{,} \Nter{Name}} \opt{\ter{,} \ter{\ldots}} 4476 \Nter{Name} \rep{\ter{,} \Nter{Name}} \opt{\ter{,} \ter{\ldots}}
4469\Or \ter{\ldots} 4477\Or \ter{\ldots}
4470} 4478}
@@ -4482,9 +4490,9 @@ enclosed in single quotes.
4482 4490
4483\end{Produc} 4491\end{Produc}
4484 4492
4485%}=============================================================== 4493\C{]===============================================================}
4486 4494
4487% Index 4495\C{ Index}
4488 4496
4489\newpage 4497\newpage
4490\addcontentsline{toc}{section}{Index} 4498\addcontentsline{toc}{section}{Index}
@@ -4492,3 +4500,4 @@ enclosed in single quotes.
4492 4500
4493\end{document} 4501\end{document}
4494%)]} 4502%)]}
4503