diff options
author | Lua Team <team@lua.org> | 2004-03-17 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2004-03-17 12:00:00 +0000 |
commit | e7731a8fb8a317aa5c444ef073bfad82fa5baa54 (patch) | |
tree | 75b630332e6cdce8b40acf3282e1e8eee27b579e | |
parent | 72286a8eeb927e1a33f24e9d99bb37ec5343ad45 (diff) | |
download | lua-github-5.0.2.tar.gz |
Lua 5.0.25.0.2
-rw-r--r-- | COPYRIGHT | 2 | ||||
-rw-r--r-- | DIFFS | 523 | ||||
-rw-r--r-- | MANIFEST | 259 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | UPDATE | 7 | ||||
-rw-r--r-- | doc/contents.html | 123 | ||||
-rw-r--r-- | doc/readme.html | 4 | ||||
-rw-r--r-- | include/lua.h | 8 | ||||
-rw-r--r-- | src/lib/lbaselib.c | 5 | ||||
-rw-r--r-- | src/lvm.c | 7 | ||||
-rw-r--r-- | test/compat.lua | 192 | ||||
-rw-r--r-- | test/table.lua | 2 |
12 files changed, 337 insertions, 798 deletions
@@ -9,7 +9,7 @@ For details and rationale, see http://www.lua.org/license.html . =============================================================================== -Copyright (C) 2003 Tecgraf, PUC-Rio. +Copyright (C) 2003-2004 Tecgraf, PUC-Rio. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -1,456 +1,38 @@ -diff -r lua-5.0/doc/manual.html lua-5.0.1/doc/manual.html -5c5 -< <title>Lua 5.0 Reference Manual</title> ---- -> <TITLE>Lua: 5.0 reference manual</TITLE> -12,14c12 -< <a HREF="http://www.lua.org/home.html"> -< <img SRC="logo.gif" ALT="[Lua logo]" BORDER=0> -< </a> ---- -> <A HREF="http://www.lua.org/home.html"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A> -22c20 -< © 2003 TeCGraf, PUC-Rio. All rights reserved. ---- -> © 2003 Tecgraf, PUC-Rio. All rights reserved. -32c30 -< <h1>1 - Introduction</h1> ---- -> <a name="1"><h1>1 - Introduction</h1></a> -37c35 -< It also offers good suport for object-oriented programming, ---- -> It also offers good support for object-oriented programming, -54c52 -< <p>The Lua distribuition includes a stand-alone embedding program, ---- -> <p>The Lua distribution includes a stand-alone embedding program, -90c88 -< <a name="language"><h1>2 - The Language</h1></a> ---- -> <a name="language"><a name="2"><h1>2 - The Language</h1></a></a> -108c106 -< <p><a name="lexical"><h2>2.1 - Lexical Conventions</h2></a> ---- -> <p><a name="lexical"><a name="2.1"><h2>2.1 - Lexical Conventions</h2></a></a> -125,126c123 -< repeat return then true until -< while ---- -> repeat return then true until while -214c211 -< <p><a name="TypesSec"><h2>2.2 - Values and Types</h2></a> ---- -> <p><a name="TypesSec"><a name="2.2"><h2>2.2 - Values and Types</h2></a></a> -295c292 -< <p><a name="coercion"><h3>2.2.1 - Coercion</h3></a> ---- -> <p><a name="coercion"><a name="2.2.1"><h3>2.2.1 - Coercion</h3></a></a> -306c303 -< <p><a name="variables"><h2>2.3 - Variables</h2></a> ---- -> <p><a name="variables"><a name="2.3"><h2>2.3 - Variables</h2></a></a> -375c372 -< <p><a name="stats"><h2>2.4 - Statements</h2></a> ---- -> <p><a name="stats"><a name="2.4"><h2>2.4 - Statements</h2></a></a> -383c380 -< <p><a name="chunks"><h3>2.4.1 - Chunks</h3></a> ---- -> <p><a name="chunks"><a name="2.4.1"><h3>2.4.1 - Chunks</h3></a></a> -408c405 -< <p><h3>2.4.2 - Blocks</h3> ---- -> <p><a name="2.4.2"><h3>2.4.2 - Blocks</h3></a> -426c423 -< <p><a name="assignment"><h3>2.4.3 - Assignment</h3></a> ---- -> <p><a name="assignment"><a name="2.4.3"><h3>2.4.3 - Assignment</h3></a></a> -461c458 -< before it is assigned 4. ---- -> before it is assigned 4. -488c485 -< <p><a name="control"><h3>2.4.4 - Control Structures</h3></a> ---- -> <p><a name="control"><a name="2.4.4"><h3>2.4.4 - Control Structures</h3></a></a> -519c516 -< skiping to the next statement after the loop: ---- -> skipping to the next statement after the loop: -539c536 -< <p><a name="for"><h3>2.4.5 - For Statement</h3></a> ---- -> <p><a name="for"><a name="2.4.5"><h3>2.4.5 - For Statement</h3></a></a> -626c623 -< <p><a name="funcstat"><h3>2.4.6 - Function Calls as Statements</h3></a> ---- -> <p><a name="funcstat"><a name="2.4.6"><h3>2.4.6 - Function Calls as Statements</h3></a></a> -635c632 -< <p><a name="localvar"><h3>2.4.7 - Local Declarations</h3></a> ---- -> <p><a name="localvar"><a name="2.4.7"><h3>2.4.7 - Local Declarations</h3></a></a> -652c649 -< <p><a name="expressions"><h2>2.5 - Expressions</h2></a> ---- -> <p><a name="expressions"><a name="2.5"><h2>2.5 - Expressions</h2></a></a> -683c680 -< <p><h3>2.5.1 - Arithmetic Operators</h3> ---- -> <p><a name="2.5.1"><h3>2.5.1 - Arithmetic Operators</h3></a> -698c695 -< <p><a name="rel-ops"><h3>2.5.2 - Relational Operators</h3></a> ---- -> <p><a name="rel-ops"><a name="2.5.2"><h3>2.5.2 - Relational Operators</h3></a></a> -734c731 -< <p><h3>2.5.3 - Logical Operators</h3> ---- -> <p><a name="2.5.3"><h3>2.5.3 - Logical Operators</h3></a> -767c764 -< <p><a name="concat"><h3>2.5.4 - Concatenation</h3></a> ---- -> <p><a name="concat"><a name="2.5.4"><h3>2.5.4 - Concatenation</h3></a></a> -774c771 -< <p><h3>2.5.5 - Precedence</h3> ---- -> <p><a name="2.5.5"><h3>2.5.5 - Precedence</h3></a> -787c784 -< As usual, you can use parentheses to change the precedences of an expression. ---- -> You can use parentheses to change the precedences in an expression. -792c789 -< <p><a name="tableconstructor"><h3>2.5.6 - Table Constructors</h3></a> ---- -> <p><a name="tableconstructor"><a name="2.5.6"><h3>2.5.6 - Table Constructors</h3></a></a> -842c839 -< <p><a name="functioncall"><h3>2.5.7 - Function Calls</h3></a> ---- -> <p><a name="functioncall"><a name="2.5.7"><h3>2.5.7 - Function Calls</h3></a></a> -947c944 -< return x, f(x) -- adicional results ---- -> return x, f(x) -- additional results -952c949 -< <p><a name="func-def"><h3>2.5.8 - Function Definitions</h3></a> ---- -> <p><a name="func-def"><a name="2.5.8"><h3>2.5.8 - Function Definitions</h3></a></a> -1061c1058 -< <p><a name="visibility"><h2>2.6 - Visibility Rules</h2></a> ---- -> <p><a name="visibility"><a name="2.6"><h2>2.6 - Visibility Rules</h2></a></a> -1118c1115 -< <p><a name="error"><h2>2.7 - Error Handling</h2></a> ---- -> <p><a name="error"><a name="2.7"><h2>2.7 - Error Handling</h2></a></a> -1133c1130 -< <p><a name="metatable"><h2>2.8 - Metatables</h2></a> ---- -> <p><a name="metatable"><a name="2.8"><h2>2.8 - Metatables</h2></a></a> -1315c1312 -< if type(op1) ~= type(op2) then -- diferent types? ---- -> if type(op1) ~= type(op2) then -- different types? -1443c1440 -< <p><a name="GC"><h2>2.9 - Garbage Collection</h2></a> ---- -> <p><a name="GC"><a name="2.9"><h2>2.9 - Garbage Collection</h2></a></a> -1474c1471 -< <p><h3>2.9.1 - Garbage-Collection Metamethods</h3> ---- -> <p><a name="2.9.1"><h3>2.9.1 - Garbage-Collection Metamethods</h3></a> -1506c1503 -< <p><a name="weak-table"><h3>2.9.2 - Weak Tables</h3></a> ---- -> <p><a name="weak-table"><a name="2.9.2"><h3>2.9.2 - Weak Tables</h3></a></a> -1524c1521 -< If the <code>__mode</code> field is a string containing the character `<code>k</code>´, ---- -> If the <code>__mode</code> field is a string containing the character `<code>k</code>´, -1534c1531 -< <p><a name="coroutine"><h2>2.10 - Coroutines</h2></a> ---- -> <p><a name="coroutine"><a name="2.10"><h2>2.10 - Coroutines</h2></a></a> -1552c1549 -< passing as argument the thread returned by <code>coroutine.create</code>, ---- -> passing as its first argument the thread returned by <code>coroutine.create</code>, -1633c1630 -< <a name="API"><h1>3 - The Application Program Interface</h1></a> ---- -> <a name="API"><a name="3"><h1>3 - The Application Program Interface</h1></a></a> -1648c1645 -< <p><a name="mangstate"><h2>3.1 - States</h2></a> ---- -> <p><a name="mangstate"><a name="3.1"><h2>3.1 - States</h2></a></a> -1684c1681 -< <p><h2>3.2 - The Stack and Indices</h2> ---- -> <p><a name="3.2"><h2>3.2 - The Stack and Indices</h2></a> -1694c1691 -< and it is where the C function pushes its results (see <a href="#LuacallC">3.16</a>) ---- -> and it is where the C function pushes its results to be returned to the caller (see <a href="#LuacallC">3.16</a>) -1739c1736 -< it ensures that at least <code>LUA_MINSTACK</code> positions are available. +diff -r lua-5.0/COPYRIGHT lua-5.0.2/COPYRIGHT +12c12 +< Copyright (C) 2003 Tecgraf, PUC-Rio. +--- +> Copyright (C) 2003-2004 Tecgraf, PUC-Rio. +diff -r lua-5.0/Makefile lua-5.0.2/Makefile +98a99,101 +> newer: +> @find . -newer MANIFEST -type f +> +diff -r lua-5.0/doc/readme.html lua-5.0.2/doc/readme.html +16c16 +< <LI><A HREF="manual.html">Reference manual</A> --- -> it ensures that at least <code>LUA_MINSTACK</code> stack positions are available. -1763c1760 -< <p><h2>3.3 - Stack Manipulation</h2> +> <LI><A HREF="contents.html">Reference manual</A> +31c31 +< Tue Apr 1 14:35:18 EST 2003 --- -> <p><a name="3.3"><h2>3.3 - Stack Manipulation</h2></a> -1816c1813 -< <p><h2>3.4 - Querying the Stack</h2> ---- -> <p><a name="3.4"><h2>3.4 - Querying the Stack</h2></a> -1890c1887 -< <p><a name="lua-to"><h2>3.5 - Getting Values from the Stack</h2></a> ---- -> <p><a name="lua-to"><a name="3.5"><h2>3.5 - Getting Values from the Stack</h2></a></a> -1969c1966 -< <p><a name="pushing"><h2>3.6 - Pushing Values onto the Stack</h2></a> ---- -> <p><a name="pushing"><a name="3.6"><h2>3.6 - Pushing Values onto the Stack</h2></a></a> -1999,2000c1996 -< const char *lua_pushvfstring (lua_State *L, const char *fmt, -< va_list argp); ---- -> const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp); -2028c2024 -< If <code>n</code> is 1, the result is that single string ---- -> If <code>n</code> is 1, the result is that single string -2034c2030 -< <p><a name="GC-API"><h2>3.7 - Controlling Garbage Collection</h2></a> ---- -> <p><a name="GC-API"><a name="3.7"><h2>3.7 - Controlling Garbage Collection</h2></a></a> -2047c2043 -< int lua_getgccount (lua_State *L); ---- -> int lua_getgccount (lua_State *L); -2067c2063 -< <p><a name="userdata"><h2>3.8 - Userdata</h2></a> ---- -> <p><a name="userdata"><a name="3.8"><h2>3.8 - Userdata</h2></a></a> -2112c2108 -< <p><h2>3.9 - Metatables</h2> ---- -> <p><a name="3.9"><h2>3.9 - Metatables</h2></a> -2133c2129 -< <p><h2>3.10 - Loading Lua Chunks</h2> ---- -> <p><a name="3.10"><h2>3.10 - Loading Lua Chunks</h2></a> -2160c2156 -< <p><code>lua_load</code> uses an user-supplied <em>reader</em> function to read the chunk. ---- -> <p><code>lua_load</code> uses a user-supplied <em>reader</em> function to read the chunk. -2162c2158 -< it calls the reader, ---- -> <code>lua_load</code> calls the reader, -2182c2178 -< <p><h2>3.11 - Manipulating Tables</h2> ---- -> <p><a name="3.11"><h2>3.11 - Manipulating Tables</h2></a> -2263c2259 -< <p><a name="globals"><h2>3.12 - Manipulating Environments</h2></a> ---- -> <p><a name="globals"><a name="3.12"><h2>3.12 - Manipulating Environments</h2></a></a> -2295c2291 -< <p><h2>3.13 - Using Tables as Arrays</h2> ---- -> <p><a name="3.13"><h2>3.13 - Using Tables as Arrays</h2></a> -2312c2308 -< <p><h2>3.14 - Calling Functions</h2> ---- -> <p><a name="3.14"><h2>3.14 - Calling Functions</h2></a> -2367c2363 -< <p><a name="lua_pcall"><h2>3.15 - Protected Calls</h2></a> ---- -> <p><a name="lua_pcall"><a name="3.15"><h2>3.15 - Protected Calls</h2></a></a> -2414c2410 -< <p><a name="LuacallC"><h2>3.16 - Defining C Functions</h2></a> ---- -> <p><a name="LuacallC"><a name="3.16"><h2>3.16 - Defining C Functions</h2></a></a> -2482c2478 -< <p><a name="c-closure"><h2>3.17 - Defining C Closures</h2></a> ---- -> <p><a name="c-closure"><a name="3.17"><h2>3.17 - Defining C Closures</h2></a></a> -2517c2513 -< <p><a name="registry"><h2>3.18 - Registry</h2></a> ---- -> <p><a name="registry"><a name="3.18"><h2>3.18 - Registry</h2></a></a> -2535c2531 -< <p><h2>3.19 - Error Handling in C</h2> ---- -> <p><a name="3.19"><h2>3.19 - Error Handling in C</h2></a> -2542,2543c2538,2539 -< to set a recover point, -< and any error jumps to the most recent active recover point. ---- -> to set a recover point; -> any error jumps to the most recent active recover point. -2546c2542 -< Lua calls a <em>panic function</em>, ---- -> Lua calls a <em>panic function</em> -2553,2554c2549,2550 -< never returning (e.g. doing a long jump). -< Nevertheless, the corresponding Lua will not be consistent; ---- -> never returning (e.g., by doing a long jump). -> Nevertheless, the corresponding Lua state will not be consistent; -2578c2574 -< Any value returned by <code>func</code> is dicarded. ---- -> Any value returned by <code>func</code> is discarded. -2590c2586 -< <p><h2>3.20 - Threads</h2> ---- -> <p><a name="3.20"><h2>3.20 - Threads</h2></a> -2611,2616c2607,2609 -< <p>You destroy threads with <code>lua_closethread</code>: -< <PRE> -< void lua_closethread (lua_State *L, lua_State *thread); -< </PRE> -< You cannot close the sole (or last) thread of a state. -< Instead, you must close the state itself. ---- -> <p>There is no explicit function to close or to destroy a thread. -> Threads are subject to garbage collection, -> like any Lua object. -2622c2615 -< int lua_yield (lua_State *L, int nresults); ---- -> int lua_yield (lua_State *L, int nresults); -2632c2625 -< <code>lua_resume</code> returns 0 if there is no errors running the coroutine, ---- -> <code>lua_resume</code> returns 0 if there are no errors running the coroutine, -2660c2653 -< <a name="debugI"><h1>4 - The Debug Interface</h1></a> ---- -> <a name="debugI"><a name="4"><h1>4 - The Debug Interface</h1></a></a> -2669c2662 -< <p><h2>4.1 - Stack and Function Information</h2> ---- -> <p><a name="4.1"><h2>4.1 - Stack and Function Information</h2></a> -2681c2674 -< When there is no errors, <code>lua_getstack</code> returns 1; ---- -> When there are no errors, <code>lua_getstack</code> returns 1; -2789c2782 -< <p><h2>4.2 - Manipulating Local Variables and Upvalues</h2> ---- -> <p><a name="4.2"><h2>4.2 - Manipulating Local Variables and Upvalues</h2></a> -2866c2859 -< <p><a name="sub-hooks"><h2>4.3 - Hooks</h2></a> ---- -> <p><a name="sub-hooks"><a name="4.3"><h2>4.3 - Hooks</h2></a></a> -2942c2935 -< <a name="libraries"><h1>5 - Standard Libraries</h1></a> ---- -> <a name="libraries"><a name="5"><h1>5 - Standard Libraries</h1></a></a> -2985c2978 -< <p><a name="predefined"><h2>5.1 - Basic Functions</h2></a> ---- -> <p><a name="predefined"><a name="5.1"><h2>5.1 - Basic Functions</h2></a></a> -3018c3011 -< Terminates the last protected function called, ---- -> Terminates the last protected function called -3046c3039 -< <p>if the environment has a <code>"__fenv"</code> field, ---- -> <p>If the environment has a <code>"__fenv"</code> field, -3151c3144 -< That means that any error inside <code>f</code> is not propagated; ---- -> That means that any error inside <code>f</code> is not propagated; -3155c3148 -< which is true if the call succeeds without errors. ---- -> which is <B>true</B> if the call succeeds without errors. -3330c3323 -< <p><h2>5.2 - Coroutine Manipulation</h2> ---- -> <p><a name="5.2"><h2>5.2 - Coroutine Manipulation</h2></a> -3333c3326 -< the basic library, and come inside the table . ---- -> the basic library and come inside the table <code>coroutine</code>. -3388c3381 -< <p><h2>5.3 - String Manipulation</h2> ---- -> <p><a name="5.3"><h2>5.3 - String Manipulation</h2></a> -3595c3588 -< a <em>character class</em> is used to represent a set of characters. ---- -> A <em>character class</em> is used to represent a set of characters. -3651c3644 -< a <em>pattern item</em> may be ---- -> A <em>pattern item</em> may be -3688c3681 -< a <em>pattern</em> is a sequence of pattern items. ---- -> A <em>pattern</em> is a sequence of pattern items. -3715c3708 -< <p><h2>5.4 - Table Manipulation</h2> ---- -> <p><a name="5.4"><h2>5.4 - Table Manipulation</h2></a> -3824c3817 -< <p><a name="mathlib"><h2>5.5 - Mathematical Functions</h2></a> ---- -> <p><a name="mathlib"><a name="5.5"><h2>5.5 - Mathematical Functions</h2></a></a> -3879c3872 -< <p><a name="libio"><h2>5.6 - Input and Output Facilities</h2></a> ---- -> <p><a name="libio"><a name="5.6"><h2>5.6 - Input and Output Facilities</h2></a></a> -4072c4065 -< <p><a name="libiosys"><h2>5.7 - Operating System Facilities</h2></a> ---- -> <p><a name="libiosys"><a name="5.7"><h2>5.7 - Operating System Facilities</h2></a></a> -4098c4091 -< <code>wday</code> (weekday, Sunday is 1), ---- -> <code>wday</code> (weekday, Sunday is 1), -4187c4180 -< <p><h2>5.8 - The Reflexive Debug Interface</h2> ---- -> <p><a name="5.8"><h2>5.8 - The Reflexive Debug Interface</h2></a> -4323c4316 -< <a name="lua-sa"><h1>6 - Lua Stand-alone</h1></a> ---- -> <a name="lua-sa"><a name="6"><h1>6 - Lua Stand-alone</h1></a></a> -4462c4455 -< Vincent Penquerc'h, ---- -> Vincent Penquerc'h. -4583c4576 -< <p> exp ::= <b>nil</b> <b>false</b> <b>true</b> | Number | Literal | function | prefixexp | tableconstructor | exp binop exp | unop exp ---- -> <p> exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | Literal | function | prefixexp | tableconstructor | exp binop exp | unop exp -4612c4605,4609 -< </body></html> ---- -> <HR> -> <SMALL> -> Last update: -> Tue Nov 25 16:08:37 BRST 2003 -> </SMALL> -4613a4611,4612 -> </BODY> -> </HTML> -diff -r lua-5.0/include/lua.h lua-5.0.1/include/lua.h +> Thu Mar 11 23:08:56 BRT 2004 +diff -r lua-5.0/include/lua.h lua-5.0.2/include/lua.h 2c2 < ** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $ --- -> ** $Id: lua.h,v 1.175a 2003/03/18 12:31:39 roberto Exp $ -17c17 +> ** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $ +17,18c17,18 < #define LUA_VERSION "Lua 5.0" +< #define LUA_COPYRIGHT "Copyright (C) 1994-2003 Tecgraf, PUC-Rio" +--- +> #define LUA_VERSION "Lua 5.0.2" +> #define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio" +368c368 +< * Copyright (C) 1994-2003 Tecgraf, PUC-Rio. All rights reserved. --- -> #define LUA_VERSION "Lua 5.0.1" -diff -r lua-5.0/src/ldo.c lua-5.0.1/src/ldo.c +> * Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved. +diff -r lua-5.0/src/ldo.c lua-5.0.2/src/ldo.c 2c2 < ** $Id: ldo.c,v 1.217 2003/04/03 13:35:34 roberto Exp $ --- @@ -485,7 +67,7 @@ diff -r lua-5.0/src/ldo.c lua-5.0.1/src/ldo.c > } > else if (!(L->ci->state & CI_YIELD)) /* not inside a yield? */ > return resume_error(L, "cannot resume non-suspended coroutine"); -diff -r lua-5.0/src/lgc.c lua-5.0.1/src/lgc.c +diff -r lua-5.0/src/lgc.c lua-5.0.2/src/lgc.c 2c2 < ** $Id: lgc.c,v 1.171 2003/04/03 13:35:34 roberto Exp $ --- @@ -530,7 +112,7 @@ diff -r lua-5.0/src/lgc.c lua-5.0.1/src/lgc.c < checkSizes(L); --- > checkSizes(L, deadmem); -diff -r lua-5.0/src/lgc.h lua-5.0.1/src/lgc.h +diff -r lua-5.0/src/lgc.h lua-5.0.2/src/lgc.h 2c2 < ** $Id: lgc.h,v 1.19 2003/02/28 19:45:15 roberto Exp $ --- @@ -539,16 +121,22 @@ diff -r lua-5.0/src/lgc.h lua-5.0.1/src/lgc.h < void luaC_separateudata (lua_State *L); --- > size_t luaC_separateudata (lua_State *L); -diff -r lua-5.0/src/lib/lbaselib.c lua-5.0.1/src/lib/lbaselib.c +diff -r lua-5.0/src/lib/lbaselib.c lua-5.0.2/src/lib/lbaselib.c 2c2 < ** $Id: lbaselib.c,v 1.130 2003/04/03 13:35:34 roberto Exp $ --- -> ** $Id: lbaselib.c,v 1.130a 2003/04/03 13:35:34 roberto Exp $ -327c327 +> ** $Id: lbaselib.c,v 1.130b 2003/04/03 13:35:34 roberto Exp $ +276a277 +> int n = lua_gettop(L); +280c281 +< return lua_gettop(L) - 1; +--- +> return lua_gettop(L) - n; +327c328 < char buff[64]; --- > char buff[128]; -diff -r lua-5.0/src/lib/liolib.c lua-5.0.1/src/lib/liolib.c +diff -r lua-5.0/src/lib/liolib.c lua-5.0.2/src/lib/liolib.c 2c2 < ** $Id: liolib.c,v 2.39 2003/03/19 21:16:12 roberto Exp $ --- @@ -561,7 +149,7 @@ diff -r lua-5.0/src/lib/liolib.c lua-5.0.1/src/lib/liolib.c < char buff[32]; --- > char buff[128]; -diff -r lua-5.0/src/lparser.c lua-5.0.1/src/lparser.c +diff -r lua-5.0/src/lparser.c lua-5.0.2/src/lparser.c 2c2 < ** $Id: lparser.c,v 1.208 2003/04/03 13:35:34 roberto Exp $ --- @@ -579,12 +167,12 @@ diff -r lua-5.0/src/lparser.c lua-5.0.1/src/lparser.c > luaK_storevar(fs, &v, &b); > /* debug information will only see the variable after this point! */ > getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; -diff -r lua-5.0/src/luac/Makefile lua-5.0.1/src/luac/Makefile +diff -r lua-5.0/src/luac/Makefile lua-5.0.2/src/luac/Makefile 16c16 < $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) --- > $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB) -diff -r lua-5.0/src/luac/luac.c lua-5.0.1/src/luac/luac.c +diff -r lua-5.0/src/luac/luac.c lua-5.0.2/src/luac/luac.c 2c2 < ** $Id: luac.c,v 1.44 2003/04/07 20:34:20 lhf Exp $ --- @@ -593,26 +181,34 @@ diff -r lua-5.0/src/luac/luac.c lua-5.0.1/src/luac/luac.c > lua_lock(L); 185a187 > lua_unlock(L); -diff -r lua-5.0/src/lvm.c lua-5.0.1/src/lvm.c +diff -r lua-5.0/src/lvm.c lua-5.0.2/src/lvm.c 2c2 < ** $Id: lvm.c,v 1.284 2003/04/03 13:35:34 roberto Exp $ --- -> ** $Id: lvm.c,v 1.284a 2003/04/03 13:35:34 roberto Exp $ +> ** $Id: lvm.c,v 1.284b 2003/04/03 13:35:34 roberto Exp $ 69c69 < if (mask > LUA_MASKLINE) { /* instruction-hook set? */ --- > if (mask & LUA_MASKCOUNT) { /* instruction-hook set? */ -402d401 +402,403c402,403 < L->ci->u.l.pc = &pc; -405a405 +< if (L->hookmask & LUA_MASKCALL) +--- +> if (L->hookmask & LUA_MASKCALL) { +> L->ci->u.l.pc = &pc; +404a405 +> } +405a407 > L->ci->u.l.pc = &pc; -676,678c676 +676,678c678 < lua_assert(ci->u.l.pc == &pc && < ttisfunction(ci->base - 1) && < (ci->state & CI_SAVEDPC)); --- > lua_assert(ttisfunction(ci->base - 1) && (ci->state & CI_SAVEDPC)); -diff -r lua-5.0/test/luac.lua lua-5.0.1/test/luac.lua +779a780 +> +diff -r lua-5.0/test/luac.lua lua-5.0.2/test/luac.lua 4,6c4,6 < assert(arg[1]~=nil,"usage: lua luac.lua file.lua") < f=assert(io.open("luac.out","w")) @@ -621,3 +217,8 @@ diff -r lua-5.0/test/luac.lua lua-5.0.1/test/luac.lua > assert(arg[1]~=nil and arg[2]==nil,"usage: lua luac.lua file.lua") > f=assert(io.open("luac.out","wb")) > f:write(string.dump(assert(loadfile(arg[1])))) +diff -r lua-5.0/test/table.lua lua-5.0.2/test/table.lua +8c8 +< local _,_,a,b=string.find(l,'"?(%w+)"?%s*(.*)$') +--- +> local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$') @@ -1,130 +1,131 @@ -MANIFEST contents of Lua 5.0 distribution on Fri Apr 11 11:01:08 BRT 2003 -lua-5.0 -lua-5.0/COPYRIGHT -lua-5.0/HISTORY -lua-5.0/INSTALL -lua-5.0/MANIFEST -lua-5.0/Makefile -lua-5.0/README -lua-5.0/bin -lua-5.0/build -lua-5.0/config -lua-5.0/configure -lua-5.0/doc -lua-5.0/doc/logo.gif -lua-5.0/doc/lua.1 -lua-5.0/doc/lua.html -lua-5.0/doc/luac.1 -lua-5.0/doc/luac.html -lua-5.0/doc/manual.html -lua-5.0/doc/readme.html -lua-5.0/etc -lua-5.0/etc/.exrc -lua-5.0/etc/Makefile -lua-5.0/etc/README -lua-5.0/etc/bin2c.c -lua-5.0/etc/compat.lua -lua-5.0/etc/doall.lua -lua-5.0/etc/lua.ico -lua-5.0/etc/lua.magic -lua-5.0/etc/lua.xpm -lua-5.0/etc/luser_number.h -lua-5.0/etc/luser_tests.h -lua-5.0/etc/min.c -lua-5.0/etc/noparser.c -lua-5.0/etc/saconfig.c -lua-5.0/etc/trace.c -lua-5.0/include -lua-5.0/include/Makefile -lua-5.0/include/lauxlib.h -lua-5.0/include/lua.h -lua-5.0/include/lualib.h -lua-5.0/lib -lua-5.0/src -lua-5.0/src/Makefile -lua-5.0/src/README -lua-5.0/src/lapi.c -lua-5.0/src/lapi.h -lua-5.0/src/lcode.c -lua-5.0/src/lcode.h -lua-5.0/src/ldebug.c -lua-5.0/src/ldebug.h -lua-5.0/src/ldo.c -lua-5.0/src/ldo.h -lua-5.0/src/ldump.c -lua-5.0/src/lfunc.c -lua-5.0/src/lfunc.h -lua-5.0/src/lgc.c -lua-5.0/src/lgc.h -lua-5.0/src/lib -lua-5.0/src/lib/Makefile -lua-5.0/src/lib/README -lua-5.0/src/lib/lauxlib.c -lua-5.0/src/lib/lbaselib.c -lua-5.0/src/lib/ldblib.c -lua-5.0/src/lib/liolib.c -lua-5.0/src/lib/lmathlib.c -lua-5.0/src/lib/loadlib.c -lua-5.0/src/lib/lstrlib.c -lua-5.0/src/lib/ltablib.c -lua-5.0/src/llex.c -lua-5.0/src/llex.h -lua-5.0/src/llimits.h -lua-5.0/src/lmem.c -lua-5.0/src/lmem.h -lua-5.0/src/lobject.c -lua-5.0/src/lobject.h -lua-5.0/src/lopcodes.c -lua-5.0/src/lopcodes.h -lua-5.0/src/lparser.c -lua-5.0/src/lparser.h -lua-5.0/src/lstate.c -lua-5.0/src/lstate.h -lua-5.0/src/lstring.c -lua-5.0/src/lstring.h -lua-5.0/src/ltable.c -lua-5.0/src/ltable.h -lua-5.0/src/ltests.c -lua-5.0/src/ltm.c -lua-5.0/src/ltm.h -lua-5.0/src/lua -lua-5.0/src/lua/Makefile -lua-5.0/src/lua/README -lua-5.0/src/lua/lua.c -lua-5.0/src/luac -lua-5.0/src/luac/Makefile -lua-5.0/src/luac/README -lua-5.0/src/luac/luac.c -lua-5.0/src/luac/print.c -lua-5.0/src/lundump.c -lua-5.0/src/lundump.h -lua-5.0/src/lvm.c -lua-5.0/src/lvm.h -lua-5.0/src/lzio.c -lua-5.0/src/lzio.h -lua-5.0/test -lua-5.0/test/README -lua-5.0/test/bisect.lua -lua-5.0/test/cf.lua -lua-5.0/test/compat.lua -lua-5.0/test/echo.lua -lua-5.0/test/env.lua -lua-5.0/test/factorial.lua -lua-5.0/test/fib.lua -lua-5.0/test/fibfor.lua -lua-5.0/test/globals.lua -lua-5.0/test/hello.lua -lua-5.0/test/life.lua -lua-5.0/test/lua -lua-5.0/test/luac -lua-5.0/test/luac.lua -lua-5.0/test/printf.lua -lua-5.0/test/readonly.lua -lua-5.0/test/sieve.lua -lua-5.0/test/sort.lua -lua-5.0/test/table.lua -lua-5.0/test/trace-calls.lua -lua-5.0/test/trace-globals.lua -lua-5.0/test/undefined.lua -lua-5.0/test/xd.lua +MANIFEST contents of Lua 5.0.2 distribution on Wed Mar 17 17:59:01 BRT 2004 +lua-5.0.2 +lua-5.0.2/COPYRIGHT +lua-5.0.2/DIFFS +lua-5.0.2/HISTORY +lua-5.0.2/INSTALL +lua-5.0.2/MANIFEST +lua-5.0.2/Makefile +lua-5.0.2/README +lua-5.0.2/UPDATE +lua-5.0.2/bin +lua-5.0.2/build +lua-5.0.2/config +lua-5.0.2/configure +lua-5.0.2/doc +lua-5.0.2/doc/contents.html +lua-5.0.2/doc/logo.gif +lua-5.0.2/doc/lua.1 +lua-5.0.2/doc/lua.html +lua-5.0.2/doc/luac.1 +lua-5.0.2/doc/luac.html +lua-5.0.2/doc/manual.html +lua-5.0.2/doc/readme.html +lua-5.0.2/etc +lua-5.0.2/etc/Makefile +lua-5.0.2/etc/README +lua-5.0.2/etc/bin2c.c +lua-5.0.2/etc/compat.lua +lua-5.0.2/etc/doall.lua +lua-5.0.2/etc/lua.ico +lua-5.0.2/etc/lua.magic +lua-5.0.2/etc/lua.xpm +lua-5.0.2/etc/luser_number.h +lua-5.0.2/etc/luser_tests.h +lua-5.0.2/etc/min.c +lua-5.0.2/etc/noparser.c +lua-5.0.2/etc/saconfig.c +lua-5.0.2/etc/trace.c +lua-5.0.2/include +lua-5.0.2/include/Makefile +lua-5.0.2/include/lauxlib.h +lua-5.0.2/include/lua.h +lua-5.0.2/include/lualib.h +lua-5.0.2/lib +lua-5.0.2/src +lua-5.0.2/src/Makefile +lua-5.0.2/src/README +lua-5.0.2/src/lapi.c +lua-5.0.2/src/lapi.h +lua-5.0.2/src/lcode.c +lua-5.0.2/src/lcode.h +lua-5.0.2/src/ldebug.c +lua-5.0.2/src/ldebug.h +lua-5.0.2/src/ldo.c +lua-5.0.2/src/ldo.h +lua-5.0.2/src/ldump.c +lua-5.0.2/src/lfunc.c +lua-5.0.2/src/lfunc.h +lua-5.0.2/src/lgc.c +lua-5.0.2/src/lgc.h +lua-5.0.2/src/lib +lua-5.0.2/src/lib/Makefile +lua-5.0.2/src/lib/README +lua-5.0.2/src/lib/lauxlib.c +lua-5.0.2/src/lib/lbaselib.c +lua-5.0.2/src/lib/ldblib.c +lua-5.0.2/src/lib/liolib.c +lua-5.0.2/src/lib/lmathlib.c +lua-5.0.2/src/lib/loadlib.c +lua-5.0.2/src/lib/lstrlib.c +lua-5.0.2/src/lib/ltablib.c +lua-5.0.2/src/llex.c +lua-5.0.2/src/llex.h +lua-5.0.2/src/llimits.h +lua-5.0.2/src/lmem.c +lua-5.0.2/src/lmem.h +lua-5.0.2/src/lobject.c +lua-5.0.2/src/lobject.h +lua-5.0.2/src/lopcodes.c +lua-5.0.2/src/lopcodes.h +lua-5.0.2/src/lparser.c +lua-5.0.2/src/lparser.h +lua-5.0.2/src/lstate.c +lua-5.0.2/src/lstate.h +lua-5.0.2/src/lstring.c +lua-5.0.2/src/lstring.h +lua-5.0.2/src/ltable.c +lua-5.0.2/src/ltable.h +lua-5.0.2/src/ltests.c +lua-5.0.2/src/ltm.c +lua-5.0.2/src/ltm.h +lua-5.0.2/src/lua +lua-5.0.2/src/lua/Makefile +lua-5.0.2/src/lua/README +lua-5.0.2/src/lua/lua.c +lua-5.0.2/src/luac +lua-5.0.2/src/luac/Makefile +lua-5.0.2/src/luac/README +lua-5.0.2/src/luac/luac.c +lua-5.0.2/src/luac/print.c +lua-5.0.2/src/lundump.c +lua-5.0.2/src/lundump.h +lua-5.0.2/src/lvm.c +lua-5.0.2/src/lvm.h +lua-5.0.2/src/lzio.c +lua-5.0.2/src/lzio.h +lua-5.0.2/test +lua-5.0.2/test/README +lua-5.0.2/test/bisect.lua +lua-5.0.2/test/cf.lua +lua-5.0.2/test/echo.lua +lua-5.0.2/test/env.lua +lua-5.0.2/test/factorial.lua +lua-5.0.2/test/fib.lua +lua-5.0.2/test/fibfor.lua +lua-5.0.2/test/globals.lua +lua-5.0.2/test/hello.lua +lua-5.0.2/test/life.lua +lua-5.0.2/test/lua +lua-5.0.2/test/luac +lua-5.0.2/test/luac.lua +lua-5.0.2/test/printf.lua +lua-5.0.2/test/readonly.lua +lua-5.0.2/test/sieve.lua +lua-5.0.2/test/sort.lua +lua-5.0.2/test/table.lua +lua-5.0.2/test/trace-calls.lua +lua-5.0.2/test/trace-globals.lua +lua-5.0.2/test/undefined.lua +lua-5.0.2/test/xd.lua END OF MANIFEST @@ -96,4 +96,7 @@ lecho: @make echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/' @echo "-- EOF" +newer: + @find . -newer MANIFEST -type f + # (end of Makefile) @@ -1,5 +1,5 @@ -This is Lua 5.0.1, an update of Lua 5.0 that includes the following changes, -which fix all known bugs in Lua 5.0. +This is Lua 5.0.2, an update of Lua 5.0 that includes the following changes, +which fix all known bugs in Lua 5.0. For the exact differences, see DIFFS. src/ldo.c Attempt to resume running coroutine crashed Lua @@ -15,10 +15,9 @@ src/lvm.c Count hook might be called without being set src/lib/lbaselib.c Buffer overflow for unusual %p representation + Wrong number of returns from chunks loaded from stdin src/lib/liolib.c `file.close()' could not be called without arguments Buffer overflow for unusual %p representation src/luac/luac.c Missing lock/unlock - -To use this update, simply open this tarball over the original Lua 5.0 source. diff --git a/doc/contents.html b/doc/contents.html new file mode 100644 index 00000000..06bd6fb4 --- /dev/null +++ b/doc/contents.html @@ -0,0 +1,123 @@ +<HTML> +<HEAD> +<TITLE>Lua: 5.0 reference manual - contents</TITLE> +</HEAD> + +<BODY BGCOLOR="#FFFFFF"> + +<HR> +<H1> +<A HREF="http://www.lua.org/home.html"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A> +Reference manual for Lua 5.0 +</H1> + +<A HREF="manual.html">Lua 5.0 Reference Manual</A> +[ +<A HREF="manual.html">top</A> +| +<A HREF="http://www.lua.org/ftp/refman-5.0.ps.gz">ps</A> +| +<A HREF="http://www.lua.org/ftp/refman-5.0.pdf">pdf</A> +] +<P> + +<SMALL> +<A HREF="http://www.lua.org/copyright.html">Copyright</A> +© 2003 Tecgraf, PUC-Rio. All rights reserved.</SMALL> +<HR> + +<UL> +<LI><A HREF="manual.html#1">1 - Introduction</A> +<LI><A HREF="manual.html#2">2 - The Language</A> +<UL> +<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A> +<LI><A HREF="manual.html#2.2">2.2 - Values and Types</A> +<UL> +<LI><A HREF="manual.html#2.2.1">2.2.1 - Coercion</A> +</UL> +<LI><A HREF="manual.html#2.3">2.3 - Variables</A> +<LI><A HREF="manual.html#2.4">2.4 - Statements</A> +<UL> +<LI><A HREF="manual.html#2.4.1">2.4.1 - Chunks</A> +<LI><A HREF="manual.html#2.4.2">2.4.2 - Blocks</A> +<LI><A HREF="manual.html#2.4.3">2.4.3 - Assignment</A> +<LI><A HREF="manual.html#2.4.4">2.4.4 - Control Structures</A> +<LI><A HREF="manual.html#2.4.5">2.4.5 - For Statement</A> +<LI><A HREF="manual.html#2.4.6">2.4.6 - Function Calls as Statements</A> +<LI><A HREF="manual.html#2.4.7">2.4.7 - Local Declarations</A> +</UL> +<LI><A HREF="manual.html#2.5">2.5 - Expressions</A> +<UL> +<LI><A HREF="manual.html#2.5.1">2.5.1 - Arithmetic Operators</A> +<LI><A HREF="manual.html#2.5.2">2.5.2 - Relational Operators</A> +<LI><A HREF="manual.html#2.5.3">2.5.3 - Logical Operators</A> +<LI><A HREF="manual.html#2.5.4">2.5.4 - Concatenation</A> +<LI><A HREF="manual.html#2.5.5">2.5.5 - Precedence</A> +<LI><A HREF="manual.html#2.5.6">2.5.6 - Table Constructors</A> +<LI><A HREF="manual.html#2.5.7">2.5.7 - Function Calls</A> +<LI><A HREF="manual.html#2.5.8">2.5.8 - Function Definitions</A> +</UL> +</UL> +<UL> +<LI><A HREF="manual.html#2.6">2.6 - Visibility Rules</A> +<LI><A HREF="manual.html#2.7">2.7 - Error Handling</A> +<LI><A HREF="manual.html#2.8">2.8 - Metatables</A> +<LI><A HREF="manual.html#2.9">2.9 - Garbage Collection</A> +<UL> +<LI><A HREF="manual.html#2.9.1">2.9.1 - Garbage-Collection Metamethods</A> +<LI><A HREF="manual.html#2.9.2">2.9.2 - Weak Tables</A> +</UL> +<LI><A HREF="manual.html#2.10">2.10 - Coroutines</A> +</UL> +<LI><A HREF="manual.html#3">3 - The Application Program Interface</A> +<UL> +<LI><A HREF="manual.html#3.1">3.1 - States</A> +<LI><A HREF="manual.html#3.2">3.2 - The Stack and Indices</A> +<LI><A HREF="manual.html#3.3">3.3 - Stack Manipulation</A> +<LI><A HREF="manual.html#3.4">3.4 - Querying the Stack</A> +<LI><A HREF="manual.html#3.5">3.5 - Getting Values from the Stack</A> +<LI><A HREF="manual.html#3.6">3.6 - Pushing Values onto the Stack</A> +<LI><A HREF="manual.html#3.7">3.7 - Controlling Garbage Collection</A> +<LI><A HREF="manual.html#3.8">3.8 - Userdata</A> +<LI><A HREF="manual.html#3.9">3.9 - Metatables</A> +<LI><A HREF="manual.html#3.10">3.10 - Loading Lua Chunks</A> +<LI><A HREF="manual.html#3.11">3.11 - Manipulating Tables</A> +<LI><A HREF="manual.html#3.12">3.12 - Manipulating Environments</A> +<LI><A HREF="manual.html#3.13">3.13 - Using Tables as Arrays</A> +<LI><A HREF="manual.html#3.14">3.14 - Calling Functions</A> +<LI><A HREF="manual.html#3.15">3.15 - Protected Calls</A> +<LI><A HREF="manual.html#3.16">3.16 - Defining C Functions</A> +<LI><A HREF="manual.html#3.17">3.17 - Defining C Closures</A> +<LI><A HREF="manual.html#3.18">3.18 - Registry</A> +<LI><A HREF="manual.html#3.19">3.19 - Error Handling in C</A> +<LI><A HREF="manual.html#3.20">3.20 - Threads</A> +</UL> +<LI><A HREF="manual.html#4">4 - The Debug Interface</A> +<UL> +<LI><A HREF="manual.html#4.1">4.1 - Stack and Function Information</A> +<LI><A HREF="manual.html#4.2">4.2 - Manipulating Local Variables and Upvalues</A> +<LI><A HREF="manual.html#4.3">4.3 - Hooks</A> +</UL> +<LI><A HREF="manual.html#5">5 - Standard Libraries</A> +<UL> +<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A> +<LI><A HREF="manual.html#5.2">5.2 - Coroutine Manipulation</A> +<LI><A HREF="manual.html#5.3">5.3 - String Manipulation</A> +<LI><A HREF="manual.html#5.4">5.4 - Table Manipulation</A> +<LI><A HREF="manual.html#5.5">5.5 - Mathematical Functions</A> +<LI><A HREF="manual.html#5.6">5.6 - Input and Output Facilities</A> +<LI><A HREF="manual.html#5.7">5.7 - Operating System Facilities</A> +<LI><A HREF="manual.html#5.8">5.8 - The Reflexive Debug Interface</A> +</UL> +<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A> +<LI><A HREF="manual.html#BNF">The Complete Syntax of Lua</A> +</UL> + +<HR> +<SMALL> +Last update: +Wed May 7 18:34:34 EST 2003 +</SMALL> + +</BODY> +</HTML> diff --git a/doc/readme.html b/doc/readme.html index c50459d1..baa7cc8a 100644 --- a/doc/readme.html +++ b/doc/readme.html @@ -13,7 +13,7 @@ Documentation <UL> <LI><A HREF="http://www.lua.org/">Official web site</A> -<LI><A HREF="manual.html">Reference manual</A> +<LI><A HREF="contents.html">Reference manual</A> <LI><A HREF="lua.html">lua man page</A> <LI><A HREF="luac.html">luac man page</A> <LI><A HREF="../README">lua/README</A> @@ -28,7 +28,7 @@ Documentation <HR> <SMALL> Last update: -Tue Apr 1 14:35:18 EST 2003 +Thu Mar 11 23:08:56 BRT 2004 </SMALL> </BODY> diff --git a/include/lua.h b/include/lua.h index c5689379..88b0191e 100644 --- a/include/lua.h +++ b/include/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.175a 2003/03/18 12:31:39 roberto Exp $ +** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $ ** Lua - An Extensible Extension Language ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil ** http://www.lua.org mailto:info@lua.org @@ -14,8 +14,8 @@ #include <stddef.h> -#define LUA_VERSION "Lua 5.0.1" -#define LUA_COPYRIGHT "Copyright (C) 1994-2003 Tecgraf, PUC-Rio" +#define LUA_VERSION "Lua 5.0.2" +#define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" @@ -365,7 +365,7 @@ struct lua_Debug { /****************************************************************************** -* Copyright (C) 1994-2003 Tecgraf, PUC-Rio. All rights reserved. +* Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the diff --git a/src/lib/lbaselib.c b/src/lib/lbaselib.c index 45bc7cfe..b6a4baed 100644 --- a/src/lib/lbaselib.c +++ b/src/lib/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.130a 2003/04/03 13:35:34 roberto Exp $ +** $Id: lbaselib.c,v 1.130b 2003/04/03 13:35:34 roberto Exp $ ** Basic library ** See Copyright Notice in lua.h */ @@ -274,10 +274,11 @@ static int luaB_loadfile (lua_State *L) { static int luaB_dofile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); int status = luaL_loadfile(L, fname); if (status != 0) lua_error(L); lua_call(L, 0, LUA_MULTRET); - return lua_gettop(L) - 1; + return lua_gettop(L) - n; } @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 1.284a 2003/04/03 13:35:34 roberto Exp $ +** $Id: lvm.c,v 1.284b 2003/04/03 13:35:34 roberto Exp $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -399,8 +399,10 @@ StkId luaV_execute (lua_State *L) { TObject *k; const Instruction *pc; callentry: /* entry point when calling new functions */ - if (L->hookmask & LUA_MASKCALL) + if (L->hookmask & LUA_MASKCALL) { + L->ci->u.l.pc = &pc; luaD_callhook(L, LUA_HOOKCALL, -1); + } retentry: /* entry point when returning to old functions */ L->ci->u.l.pc = &pc; lua_assert(L->ci->state == CI_SAVEDPC || @@ -776,3 +778,4 @@ StkId luaV_execute (lua_State *L) { } } + diff --git a/test/compat.lua b/test/compat.lua deleted file mode 100644 index 2a7f3731..00000000 --- a/test/compat.lua +++ /dev/null @@ -1,192 +0,0 @@ -------------------------------------------------------------------- --- Real globals --- _ALERT --- _ERRORMESSAGE --- _VERSION --- _G --- assert --- error --- metatable --- next --- print --- require --- tonumber --- tostring --- type --- unpack - -------------------------------------------------------------------- --- collectgarbage --- gcinfo - --- globals - --- call -> protect(f, err) --- loadfile --- loadstring - --- rawget --- rawset - --- getargs = Main.getargs ?? - - -function do_ (f, err) - if not f then print(err); return end - local a,b = pcall(f) - if not a then print(b); return nil - else return b or true - end -end - -function dostring(s) return do_(loadstring(s)) end --- function dofile(s) return do_(loadfile(s)) end - -------------------------------------------------------------------- --- Table library -local tab = table -foreach = tab.foreach -foreachi = tab.foreachi -getn = tab.getn -tinsert = tab.insert -tremove = tab.remove -sort = tab.sort - -------------------------------------------------------------------- --- Debug library -local dbg = debug -getinfo = dbg.getinfo -getlocal = dbg.getlocal -setcallhook = function () error"`setcallhook' is deprecated" end -setlinehook = function () error"`setlinehook' is deprecated" end -setlocal = dbg.setlocal - -------------------------------------------------------------------- --- math library -local math = math -abs = math.abs -acos = function (x) return math.deg(math.acos(x)) end -asin = function (x) return math.deg(math.asin(x)) end -atan = function (x) return math.deg(math.atan(x)) end -atan2 = function (x,y) return math.deg(math.atan2(x,y)) end -ceil = math.ceil -cos = function (x) return math.cos(math.rad(x)) end -deg = math.deg -exp = math.exp -floor = math.floor -frexp = math.frexp -ldexp = math.ldexp -log = math.log -log10 = math.log10 -max = math.max -min = math.min -mod = math.mod -PI = math.pi ---??? pow = math.pow -rad = math.rad -random = math.random -randomseed = math.randomseed -sin = function (x) return math.sin(math.rad(x)) end -sqrt = math.sqrt -tan = function (x) return math.tan(math.rad(x)) end - -------------------------------------------------------------------- --- string library -local str = string -strbyte = str.byte -strchar = str.char -strfind = str.find -format = str.format -gsub = str.gsub -strlen = str.len -strlower = str.lower -strrep = str.rep -strsub = str.sub -strupper = str.upper - -------------------------------------------------------------------- --- os library -clock = os.clock -date = os.date -difftime = os.difftime -execute = os.execute --? -exit = os.exit -getenv = os.getenv -remove = os.remove -rename = os.rename -setlocale = os.setlocale -time = os.time -tmpname = os.tmpname - -------------------------------------------------------------------- --- compatibility only -getglobal = function (n) return _G[n] end -setglobal = function (n,v) _G[n] = v end - -------------------------------------------------------------------- - -local io, tab = io, table - --- IO library (files) -_STDIN = io.stdin -_STDERR = io.stderr -_STDOUT = io.stdout -_INPUT = io.stdin -_OUTPUT = io.stdout -seek = io.stdin.seek -- sick ;-) -tmpfile = io.tmpfile -closefile = io.close -openfile = io.open - -function flush (f) - if f then f:flush() - else _OUTPUT:flush() - end -end - -function readfrom (name) - if name == nil then - local f, err, cod = io.close(_INPUT) - _INPUT = io.stdin - return f, err, cod - else - local f, err, cod = io.open(name, "r") - _INPUT = f or _INPUT - return f, err, cod - end -end - -function writeto (name) - if name == nil then - local f, err, cod = io.close(_OUTPUT) - _OUTPUT = io.stdout - return f, err, cod - else - local f, err, cod = io.open(name, "w") - _OUTPUT = f or _OUTPUT - return f, err, cod - end -end - -function appendto (name) - local f, err, cod = io.open(name, "a") - _OUTPUT = f or _OUTPUT - return f, err, cod -end - -function read (...) - local f = _INPUT - if type(arg[1]) == 'userdata' then - f = tab.remove(arg, 1) - end - return f:read(unpack(arg)) -end - -function write (...) - local f = _OUTPUT - if type(arg[1]) == 'userdata' then - f = tab.remove(arg, 1) - end - return f:write(unpack(arg)) -end - diff --git a/test/table.lua b/test/table.lua index bc2cd60c..235089c0 100644 --- a/test/table.lua +++ b/test/table.lua @@ -5,7 +5,7 @@ local A while 1 do local l=io.read() if l==nil then break end - local _,_,a,b=string.find(l,'"?(%w+)"?%s*(.*)$') + local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$') if a~=A then A=a io.write("\n",a,":") end io.write(" ",b) end |