diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-14 17:07:25 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-14 17:07:25 -0300 |
| commit | 82a3be0671fd222dd53cab00183e473acb5e322f (patch) | |
| tree | 8803274fe0f6b725d0b978f1b4e0ab2e44c7791f | |
| parent | 94b5ad31f4e6bd0a93b8b156e7274e8aae7e2535 (diff) | |
| download | lua-82a3be0671fd222dd53cab00183e473acb5e322f.tar.gz lua-82a3be0671fd222dd53cab00183e473acb5e322f.tar.bz2 lua-82a3be0671fd222dd53cab00183e473acb5e322f.zip | |
some corrections + angles in radians
| -rw-r--r-- | manual.tex | 43 |
1 files changed, 29 insertions, 14 deletions
| @@ -1,7 +1,7 @@ | |||
| 1 | % $Id: manual.tex,v 1.60 2002/08/13 19:44:47 roberto Exp roberto $ | 1 | % $Id: manual.tex,v 1.61 2002/08/13 20:00:51 roberto Exp roberto $ |
| 2 | %{[( | 2 | %{[( |
| 3 | 3 | ||
| 4 | \documentclass[11pt,twoside,draft]{article} | 4 | \documentclass[11pt,twoside]{article} |
| 5 | \usepackage{fullpage} | 5 | \usepackage{fullpage} |
| 6 | \usepackage{bnf} | 6 | \usepackage{bnf} |
| 7 | \usepackage{graphicx} | 7 | \usepackage{graphicx} |
| @@ -134,7 +134,7 @@ Waldemar Celes | |||
| 134 | \tecgraf\ --- Computer Science Department --- PUC-Rio | 134 | \tecgraf\ --- Computer Science Department --- PUC-Rio |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | %\date{{\small \tt\$Date: 2002/08/13 19:44:47 $ $}} | 137 | %\date{{\small \tt\$Date: 2002/08/13 20:00:51 $ $}} |
| 138 | 138 | ||
| 139 | \maketitle | 139 | \maketitle |
| 140 | 140 | ||
| @@ -3138,7 +3138,7 @@ from the end of the string. | |||
| 3138 | Thus, the last character is at position \Math{-1}, and so on. | 3138 | Thus, the last character is at position \Math{-1}, and so on. |
| 3139 | 3139 | ||
| 3140 | The string library provides all its functions inside the table | 3140 | The string library provides all its functions inside the table |
| 3141 | \DefLIB{string}. | 3141 | \IndexLIB{string}. |
| 3142 | 3142 | ||
| 3143 | \subsubsection*{\ff \T{string.byte (s [, i])}}\DefLIB{string.byte} | 3143 | \subsubsection*{\ff \T{string.byte (s [, i])}}\DefLIB{string.byte} |
| 3144 | Returns the internal numerical code of the \M{i}-th character of \verb|s|. | 3144 | Returns the internal numerical code of the \M{i}-th character of \verb|s|. |
| @@ -3422,7 +3422,7 @@ A pattern cannot contain embedded zeros. Use \verb|%z| instead. | |||
| 3422 | 3422 | ||
| 3423 | \subsection{Table Manipulation} | 3423 | \subsection{Table Manipulation} |
| 3424 | This library provides generic functions for table manipulation, | 3424 | This library provides generic functions for table manipulation, |
| 3425 | It provides all its functions inside the table \DefLIB{table}. | 3425 | It provides all its functions inside the table \IndexLIB{table}. |
| 3426 | 3426 | ||
| 3427 | Most functions in the table library library assume that the table | 3427 | Most functions in the table library library assume that the table |
| 3428 | represents an array or a list. | 3428 | represents an array or a list. |
| @@ -3559,10 +3559,8 @@ The library provides the following functions: | |||
| 3559 | \end{verbatim} | 3559 | \end{verbatim} |
| 3560 | plus a variable \IndexLIB{math.pi}. | 3560 | plus a variable \IndexLIB{math.pi}. |
| 3561 | Most of them | 3561 | Most of them |
| 3562 | are only interfaces to the homonymous functions in the C~library, | 3562 | are only interfaces to the homonymous functions in the C~library. |
| 3563 | except that, for the trigonometric functions, | 3563 | The functions \verb|math.deg| and \verb|math.rad| convert |
| 3564 | all angles are expressed in \emph{degrees}, not radians. | ||
| 3565 | The functions \verb|math.deg| and \verb|math.rad| can be used to convert | ||
| 3566 | between radians and degrees. | 3564 | between radians and degrees. |
| 3567 | 3565 | ||
| 3568 | The function \verb|math.max| returns the maximum | 3566 | The function \verb|math.max| returns the maximum |
| @@ -3593,14 +3591,14 @@ and all input/output operations are over those default files. | |||
| 3593 | The second style uses explicit file descriptors. | 3591 | The second style uses explicit file descriptors. |
| 3594 | 3592 | ||
| 3595 | When using implicit file descriptors, | 3593 | When using implicit file descriptors, |
| 3596 | all operations are supplied by table \DefLIB{io}. | 3594 | all operations are supplied by table \IndexLIB{io}. |
| 3597 | When using explicit file descriptors, | 3595 | When using explicit file descriptors, |
| 3598 | the operation \DefLIB{io.open} returns a file descriptor, | 3596 | the operation \IndexLIB{io.open} returns a file descriptor, |
| 3599 | and then all operations are supplied as methods by the file descriptor. | 3597 | and then all operations are supplied as methods by the file descriptor. |
| 3600 | 3598 | ||
| 3601 | Moreover, the table \verb|io| also provides | 3599 | Moreover, the table \verb|io| also provides |
| 3602 | three predefined file descriptors: | 3600 | three predefined file descriptors: |
| 3603 | \DefLIB{io.stdin}, \DefLIB{io.stdout}, and \DefLIB{io.stderr}, | 3601 | \IndexLIB{io.stdin}, \IndexLIB{io.stdout}, and \IndexLIB{io.stderr}, |
| 3604 | with their usual meaning from C. | 3602 | with their usual meaning from C. |
| 3605 | 3603 | ||
| 3606 | A file handle is a userdata containing the file stream (\verb|FILE*|), | 3604 | A file handle is a userdata containing the file stream (\verb|FILE*|), |
| @@ -3613,7 +3611,8 @@ and some value different from \nil{} on success. | |||
| 3613 | 3611 | ||
| 3614 | \subsubsection*{\ff \T{io.close ([handle])}}\DefLIB{io.close} | 3612 | \subsubsection*{\ff \T{io.close ([handle])}}\DefLIB{io.close} |
| 3615 | 3613 | ||
| 3616 | Equivalent to \verb|fh:close| over the default output file. | 3614 | Equivalent to \verb|handle:close()|. |
| 3615 | Without a \verb|handle|, closes the default output file. | ||
| 3617 | 3616 | ||
| 3618 | \subsubsection*{\ff \T{io.flush ()}}\DefLIB{io.flush} | 3617 | \subsubsection*{\ff \T{io.flush ()}}\DefLIB{io.flush} |
| 3619 | 3618 | ||
| @@ -3746,7 +3745,7 @@ plus a string describing the error. | |||
| 3746 | 3745 | ||
| 3747 | \subsection{Operating System Facilities} \label{libiosys} | 3746 | \subsection{Operating System Facilities} \label{libiosys} |
| 3748 | 3747 | ||
| 3749 | This library is implemented through table \DefLIB{os}. | 3748 | This library is implemented through table \IndexLIB{os}. |
| 3750 | 3749 | ||
| 3751 | \subsubsection*{\ff \T{os.clock ()}}\DefLIB{os.clock} | 3750 | \subsubsection*{\ff \T{os.clock ()}}\DefLIB{os.clock} |
| 3752 | 3751 | ||
| @@ -4121,6 +4120,11 @@ The precedence of \rwd{or} is smaller than the precedence of \rwd{and}. | |||
| 4121 | \rwd{in} is a reserved word. | 4120 | \rwd{in} is a reserved word. |
| 4122 | 4121 | ||
| 4123 | \item | 4122 | \item |
| 4123 | The old construction \verb|for k,v in t|, where \verb|t| is a table, | ||
| 4124 | is deprecated (although it is still supported). | ||
| 4125 | Use \verb|for k,v in pairs(t)| instead. | ||
| 4126 | |||
| 4127 | \item | ||
| 4124 | When a literal string of the form \verb|[[...]]| starts with a newline, | 4128 | When a literal string of the form \verb|[[...]]| starts with a newline, |
| 4125 | this newline is ignored. | 4129 | this newline is ignored. |
| 4126 | 4130 | ||
| @@ -4138,6 +4142,17 @@ There is a compatibility script (\verb|compat.lua|) that | |||
| 4138 | redefine most of them as global names. | 4142 | redefine most of them as global names. |
| 4139 | 4143 | ||
| 4140 | \item | 4144 | \item |
| 4145 | In the math library, angles are expressed in radians. | ||
| 4146 | With the compatibility script (\verb|compat.lua|), | ||
| 4147 | functions still work in degrees. | ||
| 4148 | |||
| 4149 | \item | ||
| 4150 | The \verb|call| function is deprecated. | ||
| 4151 | Use \verb|f(unpack(tab))| instead of \verb|call(f, tab)| | ||
| 4152 | for unprotected calls, | ||
| 4153 | or the new \verb|pcall| function for protected calls. | ||
| 4154 | |||
| 4155 | \item | ||
| 4141 | \verb|dofile| do not handle errors, but simply propagate them. | 4156 | \verb|dofile| do not handle errors, but simply propagate them. |
| 4142 | 4157 | ||
| 4143 | \item | 4158 | \item |
