diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-01-21 15:45:11 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-01-21 15:45:11 -0200 |
commit | 3b5158f2a1d7e44bc67bab5c443bf034c0e2cb47 (patch) | |
tree | 5374521878687ccd0a30a15b767bdd6926b10bcc | |
parent | 60a8b94fd0e865fab202fbbd61f211fb4fde8181 (diff) | |
download | lua-3b5158f2a1d7e44bc67bab5c443bf034c0e2cb47.tar.gz lua-3b5158f2a1d7e44bc67bab5c443bf034c0e2cb47.tar.bz2 lua-3b5158f2a1d7e44bc67bab5c443bf034c0e2cb47.zip |
corrections from Asko Kauppi
-rw-r--r-- | manual.tex | 33 |
1 files changed, 16 insertions, 17 deletions
@@ -1,4 +1,4 @@ | |||
1 | % $Id: manual.tex,v 1.64 2002/12/11 13:43:15 roberto Exp roberto $ | 1 | % $Id: manual.tex,v 1.65 2003/01/20 11:03:05 roberto Exp roberto $ |
2 | %{[( | 2 | %{[( |
3 | 3 | ||
4 | \documentclass[11pt,twoside]{article} | 4 | \documentclass[11pt,twoside]{article} |
@@ -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/12/11 13:43:15 $ $}} | 137 | %\date{{\small \tt\$Date: 2003/01/20 11:03:05 $ $}} |
138 | 138 | ||
139 | \maketitle | 139 | \maketitle |
140 | 140 | ||
@@ -570,8 +570,10 @@ and can contain the C-like escape sequences | |||
570 | `\verb|\t|' (horizontal tab), | 570 | `\verb|\t|' (horizontal tab), |
571 | `\verb|\v|' (vertical tab), | 571 | `\verb|\v|' (vertical tab), |
572 | `\verb|\\|' (backslash), | 572 | `\verb|\\|' (backslash), |
573 | `\verb|\"|' (double quote), | 573 | `\verb|\"|' (quotation mark), |
574 | `\verb|\'|' (single quote), | 574 | `\verb|\'|' (apostrophe), |
575 | `\verb|\[|' (left square bracket), | ||
576 | `\verb|\]|' (right square bracket), | ||
575 | and `\verb|\|\emph{newline}' (that is, a backslash followed by a real newline, | 577 | and `\verb|\|\emph{newline}' (that is, a backslash followed by a real newline, |
576 | which results in a newline in the string). | 578 | which results in a newline in the string). |
577 | A character in a string may also be specified by its numerical value | 579 | A character in a string may also be specified by its numerical value |
@@ -1393,7 +1395,7 @@ functions \verb|setmetatable| and \verb|getmetatable| \see{pdf-getmetatable}. | |||
1393 | For each of those operations Lua associates a specific key | 1395 | For each of those operations Lua associates a specific key |
1394 | called an \emph{event}. | 1396 | called an \emph{event}. |
1395 | When Lua performs one of those operations over a table or a userdata, | 1397 | When Lua performs one of those operations over a table or a userdata, |
1396 | if checks whether that object has a metatable with the corresponding event. | 1398 | it checks whether that object has a metatable with the corresponding event. |
1397 | If so, the value associated with that key (the \IndexEmph{metamethod}) | 1399 | If so, the value associated with that key (the \IndexEmph{metamethod}) |
1398 | controls how Lua will perform the operation. | 1400 | controls how Lua will perform the operation. |
1399 | 1401 | ||
@@ -1519,11 +1521,11 @@ the \verb|<| operation. | |||
1519 | \item[``le'':]\IndexTM{lt} | 1521 | \item[``le'':]\IndexTM{lt} |
1520 | the \verb|<=| operation. | 1522 | the \verb|<=| operation. |
1521 | \begin{verbatim} | 1523 | \begin{verbatim} |
1522 | function lt_event (op1, op2) | 1524 | function le_event (op1, op2) |
1523 | if type(op1) == "number" and type(op2) == "number" then | 1525 | if type(op1) == "number" and type(op2) == "number" then |
1524 | return op1 < op2 -- numeric comparison | 1526 | return op1 <= op2 -- numeric comparison |
1525 | elseif type(op1) == "string" and type(op2) == "string" then | 1527 | elseif type(op1) == "string" and type(op2) == "string" then |
1526 | return op1 < op2 -- lexicographic comparison | 1528 | return op1 <= op2 -- lexicographic comparison |
1527 | else | 1529 | else |
1528 | local h = getbinhandler(op1, op2, "__le") | 1530 | local h = getbinhandler(op1, op2, "__le") |
1529 | if h then | 1531 | if h then |
@@ -1804,13 +1806,10 @@ like a daemon or a web server --- | |||
1804 | might need to release states as soon as they are not needed, | 1806 | might need to release states as soon as they are not needed, |
1805 | to avoid growing too large. | 1807 | to avoid growing too large. |
1806 | 1808 | ||
1807 | With the exception of \verb|lua_open|, | ||
1808 | all functions in the Lua API need a state as their first argument. | ||
1809 | |||
1810 | 1809 | ||
1811 | \subsection{Threads} | 1810 | \subsection{Threads} |
1812 | 1811 | ||
1813 | Lua offers a partial support for multiple threads of execution. | 1812 | Lua offers partial support for multiple threads of execution. |
1814 | If you have a C~library that offers multi-threading, | 1813 | If you have a C~library that offers multi-threading, |
1815 | then Lua can cooperate with it to implement the equivalent facility in Lua. | 1814 | then Lua can cooperate with it to implement the equivalent facility in Lua. |
1816 | Also, Lua implements its own coroutine system on top of threads. | 1815 | Also, Lua implements its own coroutine system on top of threads. |
@@ -2247,7 +2246,7 @@ and then it frees its corresponding memory. | |||
2247 | 2246 | ||
2248 | \subsection{Metatables} | 2247 | \subsection{Metatables} |
2249 | 2248 | ||
2250 | The following functions allow you do manipulate the metatables | 2249 | The following functions allow you to manipulate the metatables |
2251 | of an object: | 2250 | of an object: |
2252 | \begin{verbatim} | 2251 | \begin{verbatim} |
2253 | int lua_getmetatable (lua_State *L, int objindex); | 2252 | int lua_getmetatable (lua_State *L, int objindex); |
@@ -2338,7 +2337,7 @@ The table is left where it was in the stack; | |||
2338 | this is convenient for getting multiple values from a table. | 2337 | this is convenient for getting multiple values from a table. |
2339 | 2338 | ||
2340 | As in Lua, this function may trigger a metamethod | 2339 | As in Lua, this function may trigger a metamethod |
2341 | for the ``gettable'' or ``index'' events \see{metatable}. | 2340 | for the ``index'' event \see{metatable}. |
2342 | To get the real value of any table key, | 2341 | To get the real value of any table key, |
2343 | without invoking any metamethod, | 2342 | without invoking any metamethod, |
2344 | use the \emph{raw} version: | 2343 | use the \emph{raw} version: |
@@ -2989,7 +2988,7 @@ The current content of this string is {\tt "Lua \Version"}. | |||
2989 | 2988 | ||
2990 | \subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert} | 2989 | \subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert} |
2991 | Issues an \emph{``assertion failed!''} error | 2990 | Issues an \emph{``assertion failed!''} error |
2992 | when its argument \verb|v| is \nil; | 2991 | when its argument \verb|v| is \nil{} or \false; |
2993 | otherwise, returns this argument. | 2992 | otherwise, returns this argument. |
2994 | This function is equivalent to the following Lua function: | 2993 | This function is equivalent to the following Lua function: |
2995 | \begin{verbatim} | 2994 | \begin{verbatim} |
@@ -3692,10 +3691,10 @@ so that subsequent calls to \verb|table.getn(table)| return \verb|n|. | |||
3692 | This library is an interface to most of the functions of the | 3691 | This library is an interface to most of the functions of the |
3693 | standard C~math library. | 3692 | standard C~math library. |
3694 | (Some have slightly different names.) | 3693 | (Some have slightly different names.) |
3695 | It provides all its functions inside the table \verb|math|\DefLIB{math}. | 3694 | It provides all its functions inside the table \IndexLIB{math}. |
3696 | In addition, | 3695 | In addition, |
3697 | it registers a ??tag method for the binary exponentiation operator \verb|^| | 3696 | it registers a ??tag method for the binary exponentiation operator \verb|^| |
3698 | that returns \Math{x^y} when applied to numbers \verb|x^y|. | 3697 | that returns \Math{x^y} when applied to numbers \verb|x| and \verb|y|. |
3699 | 3698 | ||
3700 | The library provides the following functions: | 3699 | The library provides the following functions: |
3701 | \DefLIB{math.abs}\DefLIB{math.acos}\DefLIB{math.asin}\DefLIB{math.atan} | 3700 | \DefLIB{math.abs}\DefLIB{math.acos}\DefLIB{math.asin}\DefLIB{math.atan} |