diff -r lua-5.0/doc/manual.html lua-5.0.1/doc/manual.html 5c5 < Lua 5.0 Reference Manual --- > Lua: 5.0 reference manual 12,14c12 < < [Lua logo] < --- > Lua 22c20 < © 2003 TeCGraf, PUC-Rio. All rights reserved. --- > © 2003 Tecgraf, PUC-Rio. All rights reserved. 32c30 <

1 - Introduction

--- >

1 - Introduction

37c35 < It also offers good suport for object-oriented programming, --- > It also offers good support for object-oriented programming, 54c52 <

The Lua distribuition includes a stand-alone embedding program, --- >

The Lua distribution includes a stand-alone embedding program, 90c88 <

2 - The Language

--- >

2 - The Language

108c106 <

2.1 - Lexical Conventions

--- >

2.1 - Lexical Conventions

125,126c123 < repeat return then true until < while --- > repeat return then true until while 214c211 <

2.2 - Values and Types

--- >

2.2 - Values and Types

295c292 <

2.2.1 - Coercion

--- >

2.2.1 - Coercion

306c303 <

2.3 - Variables

--- >

2.3 - Variables

375c372 <

2.4 - Statements

--- >

2.4 - Statements

383c380 <

2.4.1 - Chunks

--- >

2.4.1 - Chunks

408c405 <

2.4.2 - Blocks

--- >

2.4.2 - Blocks

426c423 <

2.4.3 - Assignment

--- >

2.4.3 - Assignment

461c458 < before it is assigned 4. --- > before it is assigned 4. 488c485 <

2.4.4 - Control Structures

--- >

2.4.4 - Control Structures

519c516 < skiping to the next statement after the loop: --- > skipping to the next statement after the loop: 539c536 <

2.4.5 - For Statement

--- >

2.4.5 - For Statement

626c623 <

2.4.6 - Function Calls as Statements

--- >

2.4.6 - Function Calls as Statements

635c632 <

2.4.7 - Local Declarations

--- >

2.4.7 - Local Declarations

652c649 <

2.5 - Expressions

--- >

2.5 - Expressions

683c680 <

2.5.1 - Arithmetic Operators

--- >

2.5.1 - Arithmetic Operators

698c695 <

2.5.2 - Relational Operators

--- >

2.5.2 - Relational Operators

734c731 <

2.5.3 - Logical Operators

--- >

2.5.3 - Logical Operators

767c764 <

2.5.4 - Concatenation

--- >

2.5.4 - Concatenation

774c771 <

2.5.5 - Precedence

--- >

2.5.5 - Precedence

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 <

2.5.6 - Table Constructors

--- >

2.5.6 - Table Constructors

842c839 <

2.5.7 - Function Calls

--- >

2.5.7 - Function Calls

947c944 < return x, f(x) -- adicional results --- > return x, f(x) -- additional results 952c949 <

2.5.8 - Function Definitions

--- >

2.5.8 - Function Definitions

1061c1058 <

2.6 - Visibility Rules

--- >

2.6 - Visibility Rules

1118c1115 <

2.7 - Error Handling

--- >

2.7 - Error Handling

1133c1130 <

2.8 - Metatables

--- >

2.8 - Metatables

1315c1312 < if type(op1) ~= type(op2) then -- diferent types? --- > if type(op1) ~= type(op2) then -- different types? 1443c1440 <

2.9 - Garbage Collection

--- >

2.9 - Garbage Collection

1474c1471 <

2.9.1 - Garbage-Collection Metamethods

--- >

2.9.1 - Garbage-Collection Metamethods

1506c1503 <

2.9.2 - Weak Tables

--- >

2.9.2 - Weak Tables

1524c1521 < If the __mode field is a string containing the character `k´, --- > If the __mode field is a string containing the character `k´, 1534c1531 <

2.10 - Coroutines

--- >

2.10 - Coroutines

1552c1549 < passing as argument the thread returned by coroutine.create, --- > passing as its first argument the thread returned by coroutine.create, 1633c1630 <

3 - The Application Program Interface

--- >

3 - The Application Program Interface

1648c1645 <

3.1 - States

--- >

3.1 - States

1684c1681 <

3.2 - The Stack and Indices

--- >

3.2 - The Stack and Indices

1694c1691 < and it is where the C function pushes its results (see 3.16) --- > and it is where the C function pushes its results to be returned to the caller (see 3.16) 1739c1736 < it ensures that at least LUA_MINSTACK positions are available. --- > it ensures that at least LUA_MINSTACK stack positions are available. 1763c1760 <

3.3 - Stack Manipulation

--- >

3.3 - Stack Manipulation

1816c1813 <

3.4 - Querying the Stack

--- >

3.4 - Querying the Stack

1890c1887 <

3.5 - Getting Values from the Stack

--- >

3.5 - Getting Values from the Stack

1969c1966 <

3.6 - Pushing Values onto the Stack

--- >

3.6 - Pushing Values onto the Stack

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 n is 1, the result is that single string --- > If n is 1, the result is that single string 2034c2030 <

3.7 - Controlling Garbage Collection

--- >

3.7 - Controlling Garbage Collection

2047c2043 < int lua_getgccount (lua_State *L); --- > int lua_getgccount (lua_State *L); 2067c2063 <

3.8 - Userdata

--- >

3.8 - Userdata

2112c2108 <

3.9 - Metatables

--- >

3.9 - Metatables

2133c2129 <

3.10 - Loading Lua Chunks

--- >

3.10 - Loading Lua Chunks

2160c2156 <

lua_load uses an user-supplied reader function to read the chunk. --- >

lua_load uses a user-supplied reader function to read the chunk. 2162c2158 < it calls the reader, --- > lua_load calls the reader, 2182c2178 <

3.11 - Manipulating Tables

--- >

3.11 - Manipulating Tables

2263c2259 <

3.12 - Manipulating Environments

--- >

3.12 - Manipulating Environments

2295c2291 <

3.13 - Using Tables as Arrays

--- >

3.13 - Using Tables as Arrays

2312c2308 <

3.14 - Calling Functions

--- >

3.14 - Calling Functions

2367c2363 <

3.15 - Protected Calls

--- >

3.15 - Protected Calls

2414c2410 <

3.16 - Defining C Functions

--- >

3.16 - Defining C Functions

2482c2478 <

3.17 - Defining C Closures

--- >

3.17 - Defining C Closures

2517c2513 <

3.18 - Registry

--- >

3.18 - Registry

2535c2531 <

3.19 - Error Handling in C

--- >

3.19 - Error Handling in C

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 panic function, --- > Lua calls a panic function 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 func is dicarded. --- > Any value returned by func is discarded. 2590c2586 <

3.20 - Threads

--- >

3.20 - Threads

2611,2616c2607,2609 <

You destroy threads with lua_closethread: <

<        void lua_closethread (lua_State *L, lua_State *thread);
< 
< You cannot close the sole (or last) thread of a state. < Instead, you must close the state itself. --- >

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 < lua_resume returns 0 if there is no errors running the coroutine, --- > lua_resume returns 0 if there are no errors running the coroutine, 2660c2653 <

4 - The Debug Interface

--- >

4 - The Debug Interface

2669c2662 <

4.1 - Stack and Function Information

--- >

4.1 - Stack and Function Information

2681c2674 < When there is no errors, lua_getstack returns 1; --- > When there are no errors, lua_getstack returns 1; 2789c2782 <

4.2 - Manipulating Local Variables and Upvalues

--- >

4.2 - Manipulating Local Variables and Upvalues

2866c2859 <

4.3 - Hooks

--- >

4.3 - Hooks

2942c2935 <

5 - Standard Libraries

--- >

5 - Standard Libraries

2985c2978 <

5.1 - Basic Functions

--- >

5.1 - Basic Functions

3018c3011 < Terminates the last protected function called, --- > Terminates the last protected function called 3046c3039 <

if the environment has a "__fenv" field, --- >

If the environment has a "__fenv" field, 3151c3144 < That means that any error inside f is not propagated; --- > That means that any error inside f is not propagated; 3155c3148 < which is true if the call succeeds without errors. --- > which is true if the call succeeds without errors. 3330c3323 <

5.2 - Coroutine Manipulation

--- >

5.2 - Coroutine Manipulation

3333c3326 < the basic library, and come inside the table . --- > the basic library and come inside the table coroutine. 3388c3381 <

5.3 - String Manipulation

--- >

5.3 - String Manipulation

3595c3588 < a character class is used to represent a set of characters. --- > A character class is used to represent a set of characters. 3651c3644 < a pattern item may be --- > A pattern item may be 3688c3681 < a pattern is a sequence of pattern items. --- > A pattern is a sequence of pattern items. 3715c3708 <

5.4 - Table Manipulation

--- >

5.4 - Table Manipulation

3824c3817 <

5.5 - Mathematical Functions

--- >

5.5 - Mathematical Functions

3879c3872 <

5.6 - Input and Output Facilities

--- >

5.6 - Input and Output Facilities

4072c4065 <

5.7 - Operating System Facilities

--- >

5.7 - Operating System Facilities

4098c4091 < wday (weekday, Sunday is 1), --- > wday (weekday, Sunday is 1), 4187c4180 <

5.8 - The Reflexive Debug Interface

--- >

5.8 - The Reflexive Debug Interface

4323c4316 <

6 - Lua Stand-alone

--- >

6 - Lua Stand-alone

4462c4455 < Vincent Penquerc'h, --- > Vincent Penquerc'h. 4583c4576 <

exp ::= nil false true | Number | Literal | function | prefixexp | tableconstructor | exp binop exp | unop exp --- >

exp ::= nil | false | true | Number | Literal | function | prefixexp | tableconstructor | exp binop exp | unop exp 4612c4605,4609 < --- >


> > Last update: > Tue Nov 25 16:08:37 BRST 2003 > 4613a4611,4612 > > diff -r lua-5.0/include/lua.h lua-5.0.1/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 < #define LUA_VERSION "Lua 5.0" --- > #define LUA_VERSION "Lua 5.0.1" diff -r lua-5.0/src/ldo.c lua-5.0.1/src/ldo.c 2c2 < ** $Id: ldo.c,v 1.217 2003/04/03 13:35:34 roberto Exp $ --- > ** $Id: ldo.c,v 1.217a 2003/04/03 13:35:34 roberto Exp $ 325,326c325 < if (nargs >= L->top - L->base) < luaG_runerror(L, "cannot resume dead coroutine"); --- > lua_assert(nargs < L->top - L->base); 329c328,329 < else if (ci->state & CI_YIELD) { /* inside a yield? */ --- > else { /* inside a yield */ > lua_assert(ci->state & CI_YIELD); 344,345d343 < else < luaG_runerror(L, "cannot resume non-suspended coroutine"); 351a350,358 > static int resume_error (lua_State *L, const char *msg) { > L->top = L->ci->base; > setsvalue2s(L->top, luaS_new(L, msg)); > incr_top(L); > lua_unlock(L); > return LUA_ERRRUN; > } > > 355a363,368 > if (L->ci == L->base_ci) { > if (nargs >= L->top - L->base) > return resume_error(L, "cannot resume dead coroutine"); > } > 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 2c2 < ** $Id: lgc.c,v 1.171 2003/04/03 13:35:34 roberto Exp $ --- > ** $Id: lgc.c,v 1.171a 2003/04/03 13:35:34 roberto Exp $ 113c113,114 < void luaC_separateudata (lua_State *L) { --- > size_t luaC_separateudata (lua_State *L) { > size_t deadmem = 0; 127a129 > deadmem += sizeudata(gcotou(curr)->uv.len); 136a139 > return deadmem; 247c250 < if (!(ci->state & CI_C) && lim < ci->top) --- > if (lim < ci->top) 390c393 < static void checkSizes (lua_State *L) { --- > static void checkSizes (lua_State *L, size_t deadmem) { 400c403 < G(L)->GCthreshold = 2*G(L)->nblocks; /* new threshold */ --- > G(L)->GCthreshold = 2*G(L)->nblocks - deadmem; /* new threshold */ 454c457,458 < static void mark (lua_State *L) { --- > static size_t mark (lua_State *L) { > size_t deadmem; 467c471 < luaC_separateudata(L); /* separate userdata to be preserved */ --- > deadmem = luaC_separateudata(L); /* separate userdata to be preserved */ 475a480 > return deadmem; 480c485 < mark(L); --- > size_t deadmem = mark(L); 482c487 < checkSizes(L); --- > checkSizes(L, deadmem); diff -r lua-5.0/src/lgc.h lua-5.0.1/src/lgc.h 2c2 < ** $Id: lgc.h,v 1.19 2003/02/28 19:45:15 roberto Exp $ --- > ** $Id: lgc.h,v 1.19a 2003/02/28 19:45:15 roberto Exp $ 18c18 < 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 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 < char buff[64]; --- > char buff[128]; diff -r lua-5.0/src/lib/liolib.c lua-5.0.1/src/lib/liolib.c 2c2 < ** $Id: liolib.c,v 2.39 2003/03/19 21:16:12 roberto Exp $ --- > ** $Id: liolib.c,v 2.39a 2003/03/19 21:16:12 roberto Exp $ 161c161 < if (lua_isnone(L, 1)) { --- > if (lua_isnone(L, 1) && lua_type(L, lua_upvalueindex(1)) == LUA_TTABLE) { 178c178 < char buff[32]; --- > char buff[128]; diff -r lua-5.0/src/lparser.c lua-5.0.1/src/lparser.c 2c2 < ** $Id: lparser.c,v 1.208 2003/04/03 13:35:34 roberto Exp $ --- > ** $Id: lparser.c,v 1.208a 2003/04/03 13:35:34 roberto Exp $ 1143a1144 > FuncState *fs = ls->fs; 1145c1146,1147 < init_exp(&v, VLOCAL, ls->fs->freereg++); --- > init_exp(&v, VLOCAL, fs->freereg); > luaK_reserveregs(fs, 1); 1148c1150,1152 < luaK_storevar(ls->fs, &v, &b); --- > 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 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 2c2 < ** $Id: luac.c,v 1.44 2003/04/07 20:34:20 lhf Exp $ --- > ** $Id: luac.c,v 1.44a 2003/04/07 20:34:20 lhf Exp $ 184a185 > lua_lock(L); 185a187 > lua_unlock(L); diff -r lua-5.0/src/lvm.c lua-5.0.1/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 $ 69c69 < if (mask > LUA_MASKLINE) { /* instruction-hook set? */ --- > if (mask & LUA_MASKCOUNT) { /* instruction-hook set? */ 402d401 < L->ci->u.l.pc = &pc; 405a405 > L->ci->u.l.pc = &pc; 676,678c676 < 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 4,6c4,6 < assert(arg[1]~=nil,"usage: lua luac.lua file.lua") < f=assert(io.open("luac.out","w")) < f:write(string.dump(loadfile(arg[1]))) --- > 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]))))