diff options
| -rw-r--r-- | manual.tex | 39 |
1 files changed, 21 insertions, 18 deletions
| @@ -1,4 +1,4 @@ | |||
| 1 | % $Id: manual.tex,v 2.13 1997/09/16 19:01:10 roberto Exp $ | 1 | % $Id: manual.tex,v 1.1 1998/01/02 18:34:00 roberto Exp roberto $ |
| 2 | 2 | ||
| 3 | \documentstyle[fullpage,11pt,bnf]{article} | 3 | \documentstyle[fullpage,11pt,bnf]{article} |
| 4 | 4 | ||
| @@ -38,7 +38,7 @@ Waldemar Celes | |||
| 38 | \tecgraf\ --- Computer Science Department --- PUC-Rio | 38 | \tecgraf\ --- Computer Science Department --- PUC-Rio |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | \date{\small \verb$Date: 1997/09/16 19:01:10 $} | 41 | \date{\small \verb$Date: 1998/01/02 18:34:00 $} |
| 42 | 42 | ||
| 43 | \maketitle | 43 | \maketitle |
| 44 | 44 | ||
| @@ -486,7 +486,7 @@ function calls can be executed as statements: | |||
| 486 | \produc{stat}{functioncall} | 486 | \produc{stat}{functioncall} |
| 487 | \end{Produc}% | 487 | \end{Produc}% |
| 488 | In this case, returned values are thrown away. | 488 | In this case, returned values are thrown away. |
| 489 | Function calls are explained in Section~\ref{functioncall}. | 489 | Function calls are explained in \See{functioncall}. |
| 490 | 490 | ||
| 491 | \subsubsection{Local Declarations} \label{localvar} | 491 | \subsubsection{Local Declarations} \label{localvar} |
| 492 | \Index{Local variables} may be declared anywhere inside a block. | 492 | \Index{Local variables} may be declared anywhere inside a block. |
| @@ -522,11 +522,11 @@ Basic expressions are: | |||
| 522 | \end{Produc}% | 522 | \end{Produc}% |
| 523 | 523 | ||
| 524 | Numbers (numerical constants) and | 524 | Numbers (numerical constants) and |
| 525 | string literals are explained in Section~\ref{lexical}; | 525 | string literals are explained in \See{lexical}; |
| 526 | variables are explained in Section~\ref{assignment}; | 526 | variables are explained in \See{assignment}; |
| 527 | upvalues are explained in Section~\ref{upvalue}; | 527 | upvalues are explained in \See{upvalue}; |
| 528 | function definitions (\M{function}) are explained in Section~\ref{func-def}; | 528 | function definitions (\M{function}) are explained in \See{func-def}; |
| 529 | function call are explained in Section~\ref{functioncall}. | 529 | function call are explained in \See{functioncall}. |
| 530 | 530 | ||
| 531 | An access to a global variable \verb|x| is equivalent to a | 531 | An access to a global variable \verb|x| is equivalent to a |
| 532 | call \verb|getglobal('x')|; | 532 | call \verb|getglobal('x')|; |
| @@ -549,7 +549,7 @@ the binary \verb|+| (addition), | |||
| 549 | \verb|/| (division) and \verb|^| (exponentiation), | 549 | \verb|/| (division) and \verb|^| (exponentiation), |
| 550 | and unary \verb|-| (negation). | 550 | and unary \verb|-| (negation). |
| 551 | If the operands are numbers, or strings that can be converted to | 551 | If the operands are numbers, or strings that can be converted to |
| 552 | numbers, according to the rules given in Section~\ref{coercion}, | 552 | numbers, according to the rules given in \See{coercion}, |
| 553 | then all operations except exponentiation have the usual meaning. | 553 | then all operations except exponentiation have the usual meaning. |
| 554 | Otherwise, an appropriate tag method is called \see{tag-method}. | 554 | Otherwise, an appropriate tag method is called \see{tag-method}. |
| 555 | An exponentiation always calls a tag method. | 555 | An exponentiation always calls a tag method. |
| @@ -571,7 +571,7 @@ Numbers and strings are compared in the usual way. | |||
| 571 | Tables, userdata and functions are compared by reference, | 571 | Tables, userdata and functions are compared by reference, |
| 572 | that is, two tables are considered equal only if they are the same table. | 572 | that is, two tables are considered equal only if they are the same table. |
| 573 | The operator \verb|~=| is exactly the negation of equality (\verb|==|). | 573 | The operator \verb|~=| is exactly the negation of equality (\verb|==|). |
| 574 | Note that the conversion rules of Section~\ref{coercion} | 574 | Note that the conversion rules of \See{coercion} |
| 575 | \emph{do not} apply to equality comparisons. | 575 | \emph{do not} apply to equality comparisons. |
| 576 | Thus, \verb|"0"==0| evaluates to false. | 576 | Thus, \verb|"0"==0| evaluates to false. |
| 577 | 577 | ||
| @@ -602,7 +602,7 @@ the second operand is evaluated only when necessary. | |||
| 602 | Lua offers a string \Index{concatenation} operator, | 602 | Lua offers a string \Index{concatenation} operator, |
| 603 | denoted by ``\IndexVerb{..}''. | 603 | denoted by ``\IndexVerb{..}''. |
| 604 | If operands are strings or numbers, then they are converted to | 604 | If operands are strings or numbers, then they are converted to |
| 605 | strings according to the rules in Section~\ref{coercion}. | 605 | strings according to the rules in \See{coercion}. |
| 606 | Otherwise, the ``concat'' tag method is called \see{tag-method}. | 606 | Otherwise, the ``concat'' tag method is called \see{tag-method}. |
| 607 | 607 | ||
| 608 | \subsubsection{Precedence} | 608 | \subsubsection{Precedence} |
| @@ -1313,7 +1313,7 @@ there is no guarantee that such pointer will be valid after the block ends | |||
| 1313 | \verb|lua_getcfunction| converts a \verb|lua_Object| to a C function. | 1313 | \verb|lua_getcfunction| converts a \verb|lua_Object| to a C function. |
| 1314 | This \verb|lua_Object| must have type \emph{CFunction}; | 1314 | This \verb|lua_Object| must have type \emph{CFunction}; |
| 1315 | otherwise, the function returns 0 (the \verb|NULL| pointer). | 1315 | otherwise, the function returns 0 (the \verb|NULL| pointer). |
| 1316 | The type \verb|lua_CFunction| is explained in Section~\ref{LuacallC}. | 1316 | The type \verb|lua_CFunction| is explained in \See{LuacallC}. |
| 1317 | 1317 | ||
| 1318 | \verb|lua_getuserdata| converts a \verb|lua_Object| to \verb|void*|. | 1318 | \verb|lua_getuserdata| converts a \verb|lua_Object| to \verb|void*|. |
| 1319 | This \verb|lua_Object| must have type \emph{userdata}; | 1319 | This \verb|lua_Object| must have type \emph{userdata}; |
| @@ -1672,7 +1672,7 @@ For some examples, see files \verb|lstrlib.c|, | |||
| 1672 | 1672 | ||
| 1673 | \subsection{References to Lua Objects} | 1673 | \subsection{References to Lua Objects} |
| 1674 | 1674 | ||
| 1675 | As noted in Section~\ref{LuacallC}, \verb|lua_Object|s are volatile. | 1675 | As noted in \See{LuacallC}, \verb|lua_Object|s are volatile. |
| 1676 | If the C code needs to keep a \verb|lua_Object| | 1676 | If the C code needs to keep a \verb|lua_Object| |
| 1677 | outside block boundaries, | 1677 | outside block boundaries, |
| 1678 | then it must create a \Def{reference} to the object. | 1678 | then it must create a \Def{reference} to the object. |
| @@ -1893,7 +1893,7 @@ and prints their values in a reasonable format. | |||
| 1893 | This function is not intended for formatted output, | 1893 | This function is not intended for formatted output, |
| 1894 | but as a quick way to show a value, | 1894 | but as a quick way to show a value, |
| 1895 | for instance for error messages or debugging. | 1895 | for instance for error messages or debugging. |
| 1896 | See Section~\ref{libio} for functions for formatted output. | 1896 | See \See{libio} for functions for formatted output. |
| 1897 | 1897 | ||
| 1898 | \subsubsection*{\ff \T{tonumber (e [, base])}}\Deffunc{tonumber} | 1898 | \subsubsection*{\ff \T{tonumber (e [, base])}}\Deffunc{tonumber} |
| 1899 | This function receives one argument, | 1899 | This function receives one argument, |
| @@ -2710,27 +2710,30 @@ Here is a list of all these incompatibilities. | |||
| 2710 | \subsection*{Incompatibilities with \Index{version 3.0}} | 2710 | \subsection*{Incompatibilities with \Index{version 3.0}} |
| 2711 | \begin{itemize} | 2711 | \begin{itemize} |
| 2712 | 2712 | ||
| 2713 | \item The whole library must be explicitly openen before used. | 2713 | \item To support for multiple contexts, |
| 2714 | the whole library must be explicitly openen before used. | ||
| 2714 | However, all standard libraries check whether Lua is already opened, | 2715 | However, all standard libraries check whether Lua is already opened, |
| 2715 | so any program that opens at least one standard library before using | 2716 | so any program that opens at least one standard library before using |
| 2716 | Lua API does not need to be corrected. | 2717 | Lua API does not need to be corrected. |
| 2717 | 2718 | ||
| 2718 | \item Function \verb|dostring| does not accept an optional second argument, | 2719 | \item Function \verb|dostring| does not accept an optional second argument, |
| 2719 | with a temporary error method. | 2720 | with a temporary error method. |
| 2720 | Now Function \verb|call| offers this facility. | 2721 | This facility is now provided by function \verb|call|. |
| 2721 | 2722 | ||
| 2722 | \item Function \verb|gsub| does not accept an optional fourth argument | 2723 | \item Function \verb|gsub| no longer accepts an optional fourth argument |
| 2723 | (a callback data, a table). | 2724 | (a callback data, a table). |
| 2724 | Closures make this feature irrelevant. | 2725 | Closures make this feature irrelevant. |
| 2725 | 2726 | ||
| 2726 | \item The syntax for function declaration is now more restricted; | 2727 | \item The syntax for function declaration is now more restricted; |
| 2727 | for instance, the old syntax \verb|function f[exp] (x) ... end| is not | 2728 | for instance, the old syntax \verb|function f[exp] (x) ... end| is not |
| 2728 | accepted in 3.1. | 2729 | accepted in 3.1. |
| 2729 | Progams should use an explicit assignment instead. | 2730 | Progams should use an explicit assignment instead, like this: |
| 2731 | \verb|f[exp] = function (x) ... end|. | ||
| 2730 | 2732 | ||
| 2731 | \item Old pre-compiled code is obsolete, and must be re-compiled. | 2733 | \item Old pre-compiled code is obsolete, and must be re-compiled. |
| 2732 | 2734 | ||
| 2733 | \item The option \verb|a=b| in Lua stand-alone does not need extra quotes. | 2735 | \item The option \verb|a=b| in Lua stand-alone does not need extra quotes. |
| 2736 | Check \See{lua-sa} for details. | ||
| 2734 | 2737 | ||
| 2735 | \end{itemize} | 2738 | \end{itemize} |
| 2736 | 2739 | ||
