aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-09 18:03:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-09 18:03:19 -0300
commit3b058177af1f940b8f6128821b3f4a3f3dc79ed0 (patch)
tree1bfc78ee1f090c6ab501e974caec143282c04915
parent586e510577aac83ab1a94e6da9b7760389d3a7f1 (diff)
downloadlua-3b058177af1f940b8f6128821b3f4a3f3dc79ed0.tar.gz
lua-3b058177af1f940b8f6128821b3f4a3f3dc79ed0.tar.bz2
lua-3b058177af1f940b8f6128821b3f4a3f3dc79ed0.zip
towards 5.0 alpha...
-rw-r--r--manual.tex315
1 files changed, 179 insertions, 136 deletions
diff --git a/manual.tex b/manual.tex
index cbaf42df..2bb72535 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.56 2002/06/06 12:49:28 roberto Exp roberto $ 1% $Id: manual.tex,v 1.57 2002/08/06 19:10:44 roberto Exp roberto $
2 2
3\documentclass[11pt,twoside,draft]{article} 3\documentclass[11pt,twoside,draft]{article}
4\usepackage{fullpage} 4\usepackage{fullpage}
@@ -133,7 +133,7 @@ Waldemar Celes
133\tecgraf\ --- Computer Science Department --- PUC-Rio 133\tecgraf\ --- Computer Science Department --- PUC-Rio
134} 134}
135 135
136%\date{{\small \tt\$Date: 2002/06/06 12:49:28 $ $}} 136%\date{{\small \tt\$Date: 2002/08/06 19:10:44 $ $}}
137 137
138\maketitle 138\maketitle
139 139
@@ -251,6 +251,8 @@ The evolution of an extension language: a history of Lua,
251\emph{Proceedings of V Brazilian Symposium on Programming Languages} (2001) B-14--B-28. 251\emph{Proceedings of V Brazilian Symposium on Programming Languages} (2001) B-14--B-28.
252\end{itemize} 252\end{itemize}
253 253
254Lua means ``moon'' in Portuguese.
255
254%------------------------------------------------------------------------------ 256%------------------------------------------------------------------------------
255\section{Lua Concepts}\label{concepts} 257\section{Lua Concepts}\label{concepts}
256 258
@@ -293,6 +295,10 @@ Lua automatically detects the file type and acts accordingly.
293\index{pre-compilation} 295\index{pre-compilation}
294 296
295 297
298\subsection{Table of Globals} \label{global-table}
299
300????
301
296\subsection{\Index{Values and Types}} \label{TypesSec} 302\subsection{\Index{Values and Types}} \label{TypesSec}
297 303
298Lua is a \emph{dynamically typed language}. 304Lua is a \emph{dynamically typed language}.
@@ -331,7 +337,7 @@ and has no pre-defined operations in Lua,
331except assignment and identity test. 337except assignment and identity test.
332However, by using \emph{metatables}, 338However, by using \emph{metatables},
333the programmer can define operations for userdata values 339the programmer can define operations for userdata values
334\see{metatables}. 340\see{metatable}.
335Userdata values cannot be created or modified in Lua, 341Userdata values cannot be created or modified in Lua,
336only through the C~API. 342only through the C~API.
337This guarantees the integrity of data owned by the host program. 343This guarantees the integrity of data owned by the host program.
@@ -966,7 +972,7 @@ Tables, userdata, and functions are compared \emph{by reference},
966that is, 972that is,
967two tables are considered equal only if they are the \emph{same} table. 973two tables are considered equal only if they are the \emph{same} table.
968 974
969??eq metamethod?? 975%% TODO eq metamethod
970 976
971Every time you create a new table (or userdata, or function), 977Every time you create a new table (or userdata, or function),
972this new value is different from any previously existing value. 978this new value is different from any previously existing value.
@@ -1358,43 +1364,18 @@ while all of them share the same \verb|x|.
1358 1364
1359\subsection{Error Handling} \label{error} 1365\subsection{Error Handling} \label{error}
1360 1366
1361%% TODO Must be rewritten!!!
1362
1363Because Lua is an extension language, 1367Because Lua is an extension language,
1364all Lua actions start from C~code in the host program 1368all Lua actions start from C~code in the host program
1365calling a function from the Lua library. 1369calling a function from the Lua library \see{pcall}.
1366Whenever an error occurs during Lua compilation or execution, 1370Whenever an error occurs during Lua compilation or execution,
1367the function \verb|_ERRORMESSAGE| is called \DefLIB{_ERRORMESSAGE} 1371control returns to C,
1368(provided it is different from \nil), 1372which can take appropriate measures
1369and then the corresponding function from the library 1373(such as to print an error message).
1370(\verb|lua_dofile|, \verb|lua_dostring|,
1371\verb|lua_dobuffer|, or \verb|lua_call|)
1372is terminated, returning an error condition.
1373
1374Memory allocation errors are an exception to the previous rule.
1375When memory allocation fails, Lua may not be able to execute the
1376\verb|_ERRORMESSAGE| function.
1377So, for this kind of error, Lua does not call
1378the \verb|_ERRORMESSAGE| function;
1379instead, the corresponding function from the library
1380returns immediately with a special error code (\verb|LUA_ERRMEM|).
1381This and other error codes are defined in \verb|lua.h|
1382\see{luado}.
1383
1384The only argument to \verb|_ERRORMESSAGE| is a string
1385describing the error.
1386The default definition for
1387this function calls \verb|_ALERT|, \DefLIB{_ALERT}
1388which prints the message to \verb|stderr| \see{alert}.
1389The standard I/O library redefines \verb|_ERRORMESSAGE|
1390and uses the debug interface \see{debugI}
1391to print some extra information,
1392such as a call-stack traceback.
1393 1374
1394Lua code can explicitly generate an error by calling the 1375Lua code can explicitly generate an error by calling the
1395function \verb|error| \see{pdf-error}. 1376function \verb|error| \see{pdf-error}.
1396Lua code can ``catch'' an error using the function 1377If you need to catch errors in Lua,
1397\verb|call| \see{pdf-call}. 1378you can use the \verb|pcall| function \see{pdf-pcall}.
1398 1379
1399 1380
1400\subsection{Metatables} \label{metatable} 1381\subsection{Metatables} \label{metatable}
@@ -2161,14 +2142,32 @@ when applied on a non-userdata value, it returns \verb|NULL|.
2161 2142
2162When Lua collects a full userdata, 2143When Lua collects a full userdata,
2163it calls its \verb|gc| metamethod, if any, 2144it calls its \verb|gc| metamethod, if any,
2164and then it automatically frees its corresponding memory. 2145and then it frees its corresponding memory.
2165 2146
2166 2147
2167\subsection{Metatables} 2148\subsection{Metatables}
2168 2149
2169%% TODO 2150The following functions allow you do manipulate the metatables
2151of an object:
2152\begin{verbatim}
2153 int lua_getmetatable (lua_State *L, int objindex);
2154 int lua_setmetatable (lua_State *L, int objindex);
2155\end{verbatim}
2156\DefAPI{lua_getmetatable}\DefAPI{lua_setmetatable}
2157Both get at \verb|objindex| a valid index for an object.
2158\verb|lua_getmetatable| pushes on the stack the metatable of that object;
2159\verb|lua_setmetatable| sets the table on the top of the stack as the
2160new metatable for that object (and pops the table).
2161
2162If the object does not have a metatable,
2163\verb|lua_getmetatable| returns 0, and pushes nothing on the stack.
2164\verb|lua_setmetatable| returns 0 when it cannot
2165set the metatable of the given object
2166(that is, when the object is not a userdata nor a table);
2167even then it pops the table from the stack.
2170 2168
2171\subsection{Loading Lua Chunks} 2169\subsection{Loading Lua Chunks}
2170
2172You can load a Lua chunk with 2171You can load a Lua chunk with
2173\begin{verbatim} 2172\begin{verbatim}
2174 typedef const char * (*lua_Chunkreader) 2173 typedef const char * (*lua_Chunkreader)
@@ -2183,9 +2182,10 @@ Everytime it needs another piece of the chunk,
2183it calls the reader, 2182it calls the reader,
2184passing along its \verb|data| parameter. 2183passing along its \verb|data| parameter.
2185The reader must return a pointer to a block of memory 2184The reader must return a pointer to a block of memory
2186with the part of the chunk, 2185with a new part of the chunk,
2187and set \verb|size| to the block size. 2186and set \verb|size| to the block size.
2188To signal the end of the chunk, the reader must return \verb|NULL|. 2187To signal the end of the chunk, the reader must return \verb|NULL|.
2188The reader function may return pieces of any size greater than zero.
2189 2189
2190In the current implementation, 2190In the current implementation,
2191the reader function cannot call any Lua function; 2191the reader function cannot call any Lua function;
@@ -2214,43 +2214,6 @@ for examples of how to use \verb|lua_load|,
2214and for some ready-to-use functions to load chunks 2214and for some ready-to-use functions to load chunks
2215from files and from strings. 2215from files and from strings.
2216 2216
2217
2218\subsection{Executing Lua Chunks}\label{luado}
2219>>>>
2220A host program can execute Lua chunks written in a file or in a string
2221by using the following functions:
2222\begin{verbatim}
2223 int lua_dofile (lua_State *L, const char *filename);
2224 int lua_dostring (lua_State *L, const char *string);
2225 int lua_dobuffer (lua_State *L, const char *buff,
2226 size_t size, const char *name);
2227\end{verbatim}
2228\DefAPI{lua_dofile}\DefAPI{lua_dostring}\DefAPI{lua_dobuffer}%
2229These functions return
22300 in case of success, or one of the following error codes
2231(defined in \verb|lua.h|)
2232if they fail:
2233\begin{itemize}
2234\item \IndexAPI{LUA_ERRRUN} ---
2235error while running the chunk.
2236\item \IndexAPI{LUA_ERRSYNTAX} ---
2237syntax error during pre-compilation.
2238\item \IndexAPI{LUA_ERRMEM} ---
2239memory allocation error.
2240For such errors, Lua does not call \verb|_ERRORMESSAGE| \see{error}.
2241\item \IndexAPI{LUA_ERRERR} ---
2242error while running \verb|_ERRORMESSAGE|.
2243For such errors, Lua does not call \verb|_ERRORMESSAGE| again, to avoid loops.
2244\item \IndexAPI{LUA_ERRFILE} ---
2245error opening the file (only for \verb|lua_dofile|).
2246In this case,
2247you may want to
2248check \verb|errno|,
2249call \verb|strerror|,
2250or call \verb|perror| to tell the user what went wrong.
2251\end{itemize}
2252
2253
2254\subsection{Manipulating Tables} 2217\subsection{Manipulating Tables}
2255 2218
2256Tables are created by calling 2219Tables are created by calling
@@ -2426,7 +2389,54 @@ to show all the details.
2426Usually programmers use several macros and auxiliar functions that 2389Usually programmers use several macros and auxiliar functions that
2427provide higher level access to Lua.) 2390provide higher level access to Lua.)
2428 2391
2429%% TODO: pcall 2392
2393\subsection{Protected Calls}\label{pcall}
2394
2395When you call a function with \verb|lua_call|,
2396any error inside the called function is propagated upwards
2397(with a \verb|longjmp|).
2398If you need to handle errors,
2399then you should use \verb|lua_pcall|:
2400\begin{verbatim}
2401 int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
2402\end{verbatim}
2403Both \verb|nargs| and \verb|nresults| have the same meaning as
2404in \verb|lua_call|.
2405If there are no errors during the call,
2406\verb|lua_pcall| behaves exactly like \verb|lua_call|.
2407Like \verb|lua_call|,
2408\verb|lua_pcall| always removes the function
2409and its arguments from the stack.
2410However, if there is any error,
2411\verb|lua_pcall| catches it,
2412pushes a single value at the stack (the error message),
2413and returns an error code.
2414
2415If \verb|errfunc| is 0,
2416then the error message returned is exactly the original error message.
2417Otherwise, \verb|errfunc| gives the stack index for an
2418\emph{error handler function}.
2419(In the current implementation, that index cannot be a pseudo-index.)
2420In case of runtime errors,
2421that function will be called with the error message,
2422and its return value will be the message returned by \verb|lua_pcall|.
2423
2424Typically, the error handler function is used to add more debug
2425information to the error message, such as a stack traceback.
2426Such information cannot be gathered after the return of \verb|lua_pcall|,
2427since by then the stack has unwound.
2428
2429The \verb|lua_pcall| function returns 0 in case of success,
2430or one of the following error codes
2431(defined in \verb|lua.h|):
2432\begin{itemize}
2433\item \IndexAPI{LUA_ERRRUN} --- a runtime error.
2434\item \IndexAPI{LUA_ERRMEM} --- memory allocation error.
2435For such errors, Lua does not call the error handler function.
2436\item \IndexAPI{LUA_ERRERR} ---
2437error while running the error handler function.
2438\end{itemize}
2439
2430 2440
2431\medskip 2441\medskip
2432 2442
@@ -2494,8 +2504,10 @@ of numerical arguments and returns their average and sum:
2494 lua_Number sum = 0; 2504 lua_Number sum = 0;
2495 int i; 2505 int i;
2496 for (i = 1; i <= n; i++) { 2506 for (i = 1; i <= n; i++) {
2497 if (!lua_isnumber(L, i)) 2507 if (!lua_isnumber(L, i)) {
2498 lua_error(L, "incorrect argument to function `average'"); 2508 lua_pushstring(L, "incorrect argument to function `average'");
2509 lua_error(L);
2510 }
2499 sum += lua_tonumber(L, i); 2511 sum += lua_tonumber(L, i);
2500 } 2512 }
2501 lua_pushnumber(L, sum/n); /* first result */ 2513 lua_pushnumber(L, sum/n); /* first result */
@@ -2565,8 +2577,8 @@ outside the life span of a C~function.
2565This table is always located at pseudo-index 2577This table is always located at pseudo-index
2566\IndexAPI{LUA_REGISTRYINDEX}. 2578\IndexAPI{LUA_REGISTRYINDEX}.
2567Any C~library can store data into this table, 2579Any C~library can store data into this table,
2568as long as it chooses a key different from other libraries. 2580as long as it chooses keys different from other libraries.
2569Typically, you can use as key a string containing the library name, 2581Typically, you should use as key a string containing your library name,
2570or a light userdata with the address of a C object in your code. 2582or a light userdata with the address of a C object in your code.
2571 2583
2572The integer keys in the registry are used by the reference mechanism, 2584The integer keys in the registry are used by the reference mechanism,
@@ -2583,7 +2595,6 @@ by means of functions and \emph{hooks},
2583which allows the construction of different 2595which allows the construction of different
2584kinds of debuggers, profilers, and other tools 2596kinds of debuggers, profilers, and other tools
2585that need ``inside information'' from the interpreter. 2597that need ``inside information'' from the interpreter.
2586This interface is declared in \verb|luadebug.h|.
2587 2598
2588\subsection{Stack and Function Information} 2599\subsection{Stack and Function Information}
2589 2600
@@ -2683,15 +2694,10 @@ Because functions in Lua are first class values,
2683they do not have a fixed name: 2694they do not have a fixed name:
2684Some functions may be the value of many global variables, 2695Some functions may be the value of many global variables,
2685while others may be stored only in a table field. 2696while others may be stored only in a table field.
2686The \verb|lua_getinfo| function checks whether the given 2697The \verb|lua_getinfo| function checks how the function was
2687function is a tag method or the value of a global variable. 2698called or whether it is the value of a global variable to
2688If the given function is a tag method, 2699find a suitable name.
2689then \verb|name| points to the event name. 2700If it cannot find a name,
2690%% TODO: mas qual o tag? Agora que temos tipos com nome, seria util saber
2691%% o tipo de TM. Em particular para mensagens de erro.
2692If the given function is the value of a global variable,
2693then \verb|name| points to the variable name.
2694If the given function is neither a tag method nor a global variable,
2695then \verb|name| is set to \verb|NULL|. 2701then \verb|name| is set to \verb|NULL|.
2696 2702
2697\item[namewhat] 2703\item[namewhat]
@@ -2727,7 +2733,6 @@ given as argument to a hook \see{sub-hooks}.
2727\verb|lua_getlocal| gets the index \verb|n| of a local variable, 2733\verb|lua_getlocal| gets the index \verb|n| of a local variable,
2728pushes its value onto the stack, 2734pushes its value onto the stack,
2729and returns its name. 2735and returns its name.
2730%% TODO: why return name?
2731\verb|lua_setlocal| assigns the value at the top of the stack 2736\verb|lua_setlocal| assigns the value at the top of the stack
2732to the variable and returns its name. 2737to the variable and returns its name.
2733Both functions return \verb|NULL| on failure, 2738Both functions return \verb|NULL| on failure,
@@ -2860,33 +2865,6 @@ This function is equivalent to the following Lua function:
2860 end 2865 end
2861\end{verbatim} 2866\end{verbatim}
2862 2867
2863??\subsubsection*{\ff \T{call (func, arg [, mode [, errhandler]])}}\DefLIB{call}
2864\label{pdf-call}
2865Calls function \verb|func| with
2866the arguments given by the table \verb|arg|.
2867The call is equivalent to
2868\begin{verbatim}
2869 func(arg[1], arg[2], ..., arg[n])
2870\end{verbatim}
2871where \verb|n| is the result of \verb|getn(arg)| \see{getn}.
2872All results from \verb|func| are simply returned by \verb|call|.
2873
2874By default,
2875if an error occurs during the call to \verb|func|,
2876the error is propagated.
2877If the string \verb|mode| contains \verb|"x"|,
2878then the call is \emph{protected}.\index{protected calls}
2879In this mode, function \verb|call| does not propagate an error,
2880regardless of what happens during the call.
2881Instead, it returns \nil{} to signal the error
2882(besides calling the appropriated error handler).
2883
2884If \verb|errhandler| is provided,
2885the error function \verb|_ERRORMESSAGE| is temporarily set to \verb|errhandler|,
2886while \verb|func| runs.
2887In particular, if \verb|errhandler| is \nil,
2888no error messages will be issued during the execution of the called function.
2889
2890\subsubsection*{\ff \T{collectgarbage ([limit])}}\DefLIB{collectgarbage} 2868\subsubsection*{\ff \T{collectgarbage ([limit])}}\DefLIB{collectgarbage}
2891 2869
2892Sets the garbage-collection threshold for the given limit 2870Sets the garbage-collection threshold for the given limit
@@ -2935,6 +2913,16 @@ Returns the number of Kbytes of dynamic memory Lua is using,
2935and (as a second result) the 2913and (as a second result) the
2936current garbage collector threshold (also in Kbytes). 2914current garbage collector threshold (also in Kbytes).
2937 2915
2916\subsubsection*{\ff \T{ipairs (t)}}\DefLIB{ipairs}
2917
2918Returns the table \verb|t| and a generator function
2919so that the construction
2920\begin{verbatim}
2921 for i,v in ipairs(t) do ... end
2922\end{verbatim}
2923will iterate over the pairs \verb|1, t[1]|, \verb|2, t[2]|, \ldots,
2924up to the first nil value of the table.
2925
2938\subsubsection*{\ff \T{loadfile (filename)}}\DefLIB{loadfile} 2926\subsubsection*{\ff \T{loadfile (filename)}}\DefLIB{loadfile}
2939Loads a file as a Lua chunk. 2927Loads a file as a Lua chunk.
2940If there is no errors, 2928If there is no errors,
@@ -2982,6 +2970,24 @@ use a numerical \rwd{for} or the function \verb|ipairs|).
2982The behavior of \verb|next| is \emph{undefined} if you change 2970The behavior of \verb|next| is \emph{undefined} if you change
2983the table during the traversal. 2971the table during the traversal.
2984 2972
2973\subsubsection*{\ff \T{pairs (t)}}\DefLIB{pairs}
2974
2975Returns the table \verb|t| and the function \verb|next|,
2976so that the construction
2977\begin{verbatim}
2978 for k,v in pairs(t) do ... end
2979\end{verbatim}
2980will iterate over all pairs of key--value of table \verb|t|.
2981
2982\subsubsection*{\ff \T{pcall (func, arg1, arg2, ...)}}\DefLIB{pcall}
2983\label{pdf-pcall}
2984Calls function \verb|func| with
2985the given arguments in protected mode.
2986Its first result is a boolean, true if the call succeeds without errors.
2987In such case, \verb|pcall| also returns all results from the call,
2988after this first result.
2989In case of any error, \verb|pcall| returns false plus the error message.
2990
2985\subsubsection*{\ff \T{print (e1, e2, ...)}}\DefLIB{print} 2991\subsubsection*{\ff \T{print (e1, e2, ...)}}\DefLIB{print}
2986Receives any number of arguments, 2992Receives any number of arguments,
2987and prints their values in \verb|stdout|, 2993and prints their values in \verb|stdout|,
@@ -3225,6 +3231,10 @@ For example, \verb|"%*g"| can be simulated with
3225String values to be formatted with 3231String values to be formatted with
3226\verb|%s| cannot contain embedded zeros. 3232\verb|%s| cannot contain embedded zeros.
3227 3233
3234\subsubsection*{\ff \T{string.gfind (s, pat)}}
3235
3236% TODO
3237
3228\subsubsection*{\ff \T{string.gsub (s, pat, repl [, n])}} 3238\subsubsection*{\ff \T{string.gsub (s, pat, repl [, n])}}
3229\DefLIB{string.gsub} 3239\DefLIB{string.gsub}
3230Returns a copy of \verb|s| 3240Returns a copy of \verb|s|
@@ -3410,7 +3420,8 @@ that value is assumed as its size.
3410You can call the \verb|table.setn| function to explicitly set 3420You can call the \verb|table.setn| function to explicitly set
3411the size of a table. 3421the size of a table.
3412\item implicit size --- 3422\item implicit size ---
3413%% TODO 3423Otherwise, the size of the object is one less the first integer index
3424with a \nil{} value.
3414\end{itemize} 3425\end{itemize}
3415For more details, see the descriptions of the \verb|table.getn| and 3426For more details, see the descriptions of the \verb|table.getn| and
3416\verb|table.setn| functions. 3427\verb|table.setn| functions.
@@ -3977,9 +3988,9 @@ The program name is stored in index 0,
3977the first argument after the program goes to index 1, 3988the first argument after the program goes to index 1,
3978and so on. 3989and so on.
3979The field \verb|n| gets the number of arguments after the program name. 3990The field \verb|n| gets the number of arguments after the program name.
3980Any argument before the program name 3991Any arguments before the program name
3981(that is, the options plus the interpreter name) 3992(that is, the interpreter name plus the options)
3982goes to negative indices. 3993go to negative indices.
3983For instance, in the call 3994For instance, in the call
3984\begin{verbatim} 3995\begin{verbatim}
3985 $ lua -la.lua b.lua t1 t2 3996 $ lua -la.lua b.lua t1 t2
@@ -4020,14 +4031,44 @@ then a more portable solution is \verb|#!/usr/bin/env lua|.)
4020%------------------------------------------------------------------------------ 4031%------------------------------------------------------------------------------
4021\section*{Acknowledgments} 4032\section*{Acknowledgments}
4022 4033
4023%% TODO rever isso? 4034The Lua team is grateful to \tecgraf{} for its continued support to Lua.
4024 4035We thank everyone at \tecgraf{},
4025The authors thank CENPES/PETROBRAS which, 4036specially the head of the group, Marcelo Gattass.
4026jointly with \tecgraf, used early versions of 4037At the risk of omitting several names,
4027this system extensively and gave valuable comments. 4038we also thank the following individuals for supporting,
4028The authors also thank Carlos Henrique Levy, 4039contributing to, and spreading the word about Lua:
4029who found the name of the game. 4040Alan Watson,
4030Lua means ``moon'' in Portuguese. 4041Andr\'e Clinio,
4042Andr\'e Costa,
4043Bret Mogilefsky,
4044Cameron Laird,
4045Carlos Cassino,
4046Carlos Henrique Levy,
4047Claudio Terra,
4048David Jeske,
4049Edgar Toernig,
4050Erik Hougaard,
4051Jim Mathies,
4052John Belmonte,
4053John Passaniti,
4054John Roll,
4055Jon Erickson,
4056Jon Kleiser,
4057Mark Ian Barlow,
4058Nick Trout,
4059Noemi Rodriguez,
4060Norman Ramsey,
4061Philippe Lhost,
4062Renata Ratton,
4063Renato Borges,
4064Renato Cerqueira,
4065Reuben Thomas,
4066Stephan Herrmann,
4067Steve Dekorte,
4068Thatcher Ulrich,
4069Tom\'as Gorham,
4070Vincent Penquerc'h.
4071Thank you!
4031 4072
4032 4073
4033\appendix 4074\appendix
@@ -4035,12 +4076,6 @@ Lua means ``moon'' in Portuguese.
4035\section*{Incompatibilities with Previous Versions} 4076\section*{Incompatibilities with Previous Versions}
4036\addcontentsline{toc}{section}{Incompatibilities with Previous Versions} 4077\addcontentsline{toc}{section}{Incompatibilities with Previous Versions}
4037 4078
4038We took a great care to avoid incompatibilities with
4039the previous public versions of Lua,
4040but some differences had to be introduced.
4041Here is a list of all these incompatibilities.
4042
4043
4044\subsection*{Incompatibilities with \Index{version 4.0}} 4079\subsection*{Incompatibilities with \Index{version 4.0}}
4045 4080
4046\subsubsection*{Changes in the Language} 4081\subsubsection*{Changes in the Language}
@@ -4069,6 +4104,14 @@ this newline is ignored.
4069\begin{itemize} 4104\begin{itemize}
4070 4105
4071\item 4106\item
4107Most library functions now are defined inside tables.
4108There is a compatibility script (\verb|compat.lua|) that
4109redefine most of them as global names.
4110
4111\item
4112\verb|dofile| do not handle errors, but simply propagate them.
4113
4114\item
4072The \verb|read| option \verb|*w| is obsolete. 4115The \verb|read| option \verb|*w| is obsolete.
4073 4116
4074\item 4117\item