diff options
author | Lua Team <team@lua.org> | 2010-11-16 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2010-11-16 12:00:00 +0000 |
commit | ccd28dfe034d5dfd130e5378a147e3e9fe7f6807 (patch) | |
tree | f1c922e8064f556c1034511afbbb3376640c4d27 /doc | |
parent | d4bba06f4b8264eee00b25ee08e982d348486aaf (diff) | |
download | lua-github-5.2.0-alpha-rc1.tar.gz |
Lua 5.2.0-alpha-rc15.2.0-alpha-rc1
Diffstat (limited to 'doc')
-rw-r--r-- | doc/contents.html | 14 | ||||
-rw-r--r-- | doc/manual.html | 100 | ||||
-rw-r--r-- | doc/readme.html | 15 |
3 files changed, 51 insertions, 78 deletions
diff --git a/doc/contents.html b/doc/contents.html index 35b51d02..199af668 100644 --- a/doc/contents.html +++ b/doc/contents.html @@ -22,8 +22,8 @@ Lua 5.2 Reference Manual <P> <IMG SRC="alert.png" ALIGN="absbottom" ALT="[!]"> -<EM>This is a work version of Lua 5.2. -Everything may change in the final version.</EM> +<EM>This is an alpha version of Lua 5.2. +Some details may change in the final version.</EM> <P> The reference manual is the official definition of the Lua language. @@ -52,7 +52,7 @@ Freely available under the terms of the <LI><A HREF="manual.html#2.1">2.1 – Values and Types</A> <LI><A HREF="manual.html#2.2">2.2 – Environments and the Global Environment</A> <LI><A HREF="manual.html#2.3">2.3 – Error Handling</A> -<LI><A HREF="manual.html#2.4">2.4 – Metatables</A> +<LI><A HREF="manual.html#2.4">2.4 – Metatables and Metamethods</A> <LI><A HREF="manual.html#2.5">2.5 – Garbage Collection</A> <UL> <LI><A HREF="manual.html#2.5.1">2.5.1 – Garbage-Collection Metamethods</A> @@ -484,7 +484,6 @@ Freely available under the terms of the <A HREF="manual.html#luaL_newlib">luaL_newlib</A><BR> <A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR> <A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR> -<A HREF="manual.html#luaL_setfuncs">luaL_setfuncs</A><BR> <A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR> <A HREF="manual.html#luaL_optint">luaL_optint</A><BR> <A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR> @@ -497,11 +496,12 @@ Freely available under the terms of the <A HREF="manual.html#luaL_pushresult">luaL_pushresult</A><BR> <A HREF="manual.html#luaL_ref">luaL_ref</A><BR> <A HREF="manual.html#luaL_requiref">luaL_requiref</A><BR> +<A HREF="manual.html#luaL_setfuncs">luaL_setfuncs</A><BR> +<A HREF="manual.html#luaL_setmetatable">luaL_setmetatable</A><BR> <A HREF="manual.html#luaL_testudata">luaL_testudata</A><BR> <A HREF="manual.html#luaL_tolstring">luaL_tolstring</A><BR> <A HREF="manual.html#luaL_traceback">luaL_traceback</A><BR> <A HREF="manual.html#luaL_typename">luaL_typename</A><BR> -<A HREF="manual.html#luaL_typeerror">luaL_typeerror</A><BR> <A HREF="manual.html#luaL_unref">luaL_unref</A><BR> <A HREF="manual.html#luaL_where">luaL_where</A><BR> @@ -512,10 +512,10 @@ Freely available under the terms of the <HR> <SMALL> Last update: -Sat Oct 30 21:34:44 BRST 2010 +Tue Nov 16 09:56:07 BRST 2010 </SMALL> <!-- -Last change: revised for Lua 5.2.0 (work5) +Last change: revised for Lua 5.2.0 (alpha) --> </BODY> diff --git a/doc/manual.html b/doc/manual.html index c97b88c1..db1af8c8 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -17,8 +17,8 @@ Lua 5.2 Reference Manual </h1> <IMG SRC="alert.png" ALIGN="absbottom" ALT="[!]"> -<EM>This is a work version of Lua 5.2. -Everything may change in the final version.</EM> +<EM>This is an alpha version of Lua 5.2. +Some details may change in the final version.</EM> <P> by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes @@ -38,7 +38,7 @@ Freely available under the terms of the <!-- ====================================================================== --> <p> -<!-- $Id: manual.of,v 1.61 2010/10/29 12:51:39 roberto Exp $ --> +<!-- $Id: manual.of,v 1.62 2010/11/16 11:38:25 roberto Exp $ --> @@ -287,7 +287,7 @@ you can use the <a href="#pdf-pcall"><code>pcall</code></a> function. -<h2>2.4 – <a name="2.4">Metatables</a></h2> +<h2>2.4 – <a name="2.4">Metatables and Metamethods</a></h2> <p> Every value in Lua can have a <em>metatable</em>. @@ -305,7 +305,7 @@ Lua calls this function to perform the addition. <p> We call the keys in a metatable <em>events</em> and the values <em>metamethods</em>. -In the previous example, the event is <code>"add"</code> +In the previous example, the event is <code>"__add"</code> and the metamethod is the function that performs the addition. @@ -383,7 +383,7 @@ and the access to objects with no metatables does not fail <p> For the unary <code>-</code> and <code>#</code> operators, -the metamethod is called repeating the first argument as a second argument. +the metamethod is called with a dummy second argument. This extra argument is only to simplify Lua's internals; it may be removed in future versions and therefore it is not present in the following code. @@ -2731,13 +2731,12 @@ It is used in the auxiliary library by <a href="#luaL_newstate"><code>luaL_newst return realloc(ptr, nsize); } </pre><p> -This code assumes +Note that ANSI C ensures that <code>free(NULL)</code> has no effect and that <code>realloc(NULL, size)</code> is equivalent to <code>malloc(size)</code>. -ANSI C ensures both behaviors. -It also assumes that <code>realloc</code> does not fail when shrinking a block. -(ANSI C does not ensure this behavior, -but it seems a safe assumption.) +This code assumes that <code>realloc</code> does not fail when shrinking a block. +ANSI C does not ensure this behavior, +but it seems a safe assumption. @@ -5989,6 +5988,19 @@ These values are popped from the stack after the registration. +<hr><h3><a name="luaL_setmetatable"><code>luaL_setmetatable</code></a></h3><p> +<span class="apii">[-0, +0, <em>-</em>]</span> +<pre>void luaL_setmetatable (lua_State *L, const char *tname);</pre> + +<p> +Sets the metatable of the object at the top of the stack +as the metatable associated with name <code>tname</code> +in the registry (see <a href="#luaL_newmetatable"><code>luaL_newmetatable</code></a>). + + + + + <hr><h3><a name="luaL_openlibs"><code>luaL_openlibs</code></a></h3><p> <span class="apii">[-0, +0, <em>e</em>]</span> <pre>void luaL_openlibs (lua_State *L);</pre> @@ -6280,24 +6292,6 @@ Returns the name of the type of the value at the given index. -<hr><h3><a name="luaL_typeerror"><code>luaL_typeerror</code></a></h3><p> -<span class="apii">[-0, +0, <em>v</em>]</span> -<pre>int luaL_typeerror (lua_State *L, int narg, const char *tname);</pre> - -<p> -Generates an error with a message like the following: - -<pre> - <em>location</em>: bad argument <em>narg</em> to '<em>func</em>' (<em>tname</em> expected, got <em>rt</em>) -</pre><p> -where <code><em>location</em></code> is produced by <a href="#luaL_where"><code>luaL_where</code></a>, -<code><em>func</em></code> is the name of the current function, -and <code><em>rt</em></code> is the type name of the actual argument. - - - - - <hr><h3><a name="luaL_unref"><code>luaL_unref</code></a></h3><p> <span class="apii">[-0, +0, <em>-</em>]</span> <pre>void luaL_unref (lua_State *L, int t, int ref);</pre> @@ -7020,8 +7014,6 @@ In case of error, propagates the error. <p> Suspends the execution of the calling coroutine. -The coroutine cannot be running a C function, -a metamethod, or an iterator. Any arguments to <code>yield</code> are passed as extra results to <code>resume</code>. @@ -8586,20 +8578,13 @@ instead of returning an error code. <p> -<hr><h3><a name="pdf-io.lines"><code>io.lines ([filename] [, keepNL])</code></a></h3> +<hr><h3><a name="pdf-io.lines"><code>io.lines ([filename] ···)</code></a></h3> <p> Opens the given file name in read mode -and returns an iterator function that, -each time it is called, -returns a new line from the file. -Therefore, the construction - -<pre> - for line in io.lines(filename) do <em>body</em> end -</pre><p> -will iterate over all lines of the file. +and returns an iterator function that +works like <code>file:lines(···)</code> over the oppened file. When the iterator function detects the end of file, it returns <b>nil</b> (to finish the loop) and automatically closes the file. @@ -8611,11 +8596,6 @@ that is, it iterates over the lines of the default input file. In this case it does not close the file when the loop ends. -<p> -By default, <code>lines</code> removes the newline at the end of each line. -If <code>keepNL</code> is <b>true</b>, it will keep the newlines. - - <p> @@ -8750,29 +8730,26 @@ Saves any written data to <code>file</code>. <p> -<hr><h3><a name="pdf-file:lines"><code>file:lines ([keepNL])</code></a></h3> +<hr><h3><a name="pdf-file:lines"><code>file:lines (···)</code></a></h3> <p> Returns an iterator function that, each time it is called, -returns a new line from the file. +reads the file according to the given formats. +When no format is given, +uses "*l" as a default. Therefore, the construction <pre> - for line in file:lines() do <em>body</em> end + for c in file:lines(1) do <em>body</em> end </pre><p> -will iterate over all lines of the file, +will iterate over all characters of the file, starting at the current position. (Unlike <a href="#pdf-io.lines"><code>io.lines</code></a>, this function does not close the file when the loop ends.) -<p> -By default, <code>lines</code> removes the newline at the end of each line. -If <code>keepNL</code> is <b>true</b>, it will keep the newlines. - - <p> @@ -9674,11 +9651,6 @@ and it is easy to set up a module with regular Lua code. </li> <li> -The debug library is not loaded by default. -You must explicitly require it. -</li> - -<li> Functions <code>setfenv</code> and <code>getfenv</code> are deprecated. To set the environment of a Lua function, use the variable <code>_ENV</code> or the new function <a href="#pdf-loadin"><code>loadin</code></a>. @@ -9767,8 +9739,8 @@ even if it is set later. </li> <li> -<code>luaL_typerror</code> was renamed <a href="#luaL_typeerror"><code>luaL_typeerror</code></a>, -to have a correct spelling. +<code>luaL_typerror</code> was deprecated. +Write your own version if you need it. </li> <li> @@ -9873,10 +9845,10 @@ Here is the complete syntax of Lua in extended BNF. <HR> <SMALL> Last update: -Sat Oct 30 21:36:20 BRST 2010 +Tue Nov 16 09:52:41 BRST 2010 </SMALL> <!-- -Last change: revised for Lua 5.2.0 (work5) +Last change: revised for Lua 5.2.0 (alpha) --> </body></html> diff --git a/doc/readme.html b/doc/readme.html index 55919999..9b0f9260 100644 --- a/doc/readme.html +++ b/doc/readme.html @@ -27,13 +27,13 @@ tt, kbd, code { <HR> <H1> <A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A> -Welcome to Lua 5.2 (work5) +Welcome to Lua 5.2 (alpha) </H1> <P> <IMG SRC="alert.png" ALIGN="absbottom" ALT="[!]"> -<EM>This is a work version of Lua 5.2. -Everything may change in the final version.</EM> +<EM>This is an alpha version of Lua 5.2. +Some details may change in the final version.</EM> <P> <A HREF="#about">about</A> @@ -323,12 +323,13 @@ Here are the other changes introduced in Lua 5.2: <LI> new <CODE>lua_compare</CODE>, <CODE>lua_arith</CODE>, and <CODE>lua_len</CODE> <LI> new <CODE>lua_version</CODE> and <CODE>luaL_version</CODE> <LI> <CODE>lua_pushstring</CODE> and <CODE>pushlstring</CODE> return string -<LI> new <CODE>luaL_testudata</CODE> +<LI> new <CODE>luaL_testudata</CODE> and <CODE>luaL_setmetatable</CODE> <LI> new <CODE>luaL_tolstring</CODE> <LI> new <CODE>lua_copy</CODE> <LI> new <CODE>lua_absindex</CODE> <LI> new <CODE>lua_upvalueid</CODE> and <CODE>lua_upvaluejoin</CODE> <LI> <CODE>nparams</CODE> and <CODE>isvarag</CODE> available in debug API +<LI> new <CODE>lua_Unsigned</CODE> </UL> <H3>Implementation</H3> @@ -337,7 +338,7 @@ Here are the other changes introduced in Lua 5.2: <LI> internal (immutable) version of ctypes <LI> simpler implementation for string buffers <LI> udata with finalizers are kept in a separated list for the GC -<LI> <CODE>CallInfo</CODE>stack now is a linked list +<LI> <CODE>CallInfo</CODE> stack now is a linked list <LI> parser uses much less C-stack space (no more auto arrays) <LI> new hash for floats <LI> handling of non-string error messages in the standalone interpreter @@ -390,10 +391,10 @@ THE SOFTWARE. <HR> <SMALL> Last update: -Sat Oct 30 21:36:38 BRST 2010 +Thu Nov 11 15:16:22 BRST 2010 </SMALL> <!-- -Last change: revised for Lua 5.2.0 (work5) +Last change: revised for Lua 5.2.0 (alpha) --> </BODY> |