aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lauxlib.c2
-rw-r--r--lgc.c2
-rw-r--r--lgc.h2
-rw-r--r--lstate.h2
-rw-r--r--lua.c4
-rw-r--r--luaconf.h2
-rw-r--r--lvm.c8
-rw-r--r--manual/manual.of32
-rw-r--r--testes/pm.lua3
9 files changed, 36 insertions, 21 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 634c85cd..1f786e15 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1044,7 +1044,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
1044 1044
1045 1045
1046/* 1046/*
1047** Standard panic funcion just prints an error message. The test 1047** Standard panic function just prints an error message. The test
1048** with 'lua_type' avoids possible memory errors in 'lua_tostring'. 1048** with 'lua_type' avoids possible memory errors in 'lua_tostring'.
1049*/ 1049*/
1050static int panic (lua_State *L) { 1050static int panic (lua_State *L) {
diff --git a/lgc.c b/lgc.c
index 700390d2..0ad3a16f 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1541,7 +1541,7 @@ static void sweepstep (lua_State *L, global_State *g,
1541** object.) When 'fast' is true, 'singlestep' tries to finish a state 1541** object.) When 'fast' is true, 'singlestep' tries to finish a state
1542** "as fast as possible". In particular, it skips the propagation 1542** "as fast as possible". In particular, it skips the propagation
1543** phase and leaves all objects to be traversed by the atomic phase: 1543** phase and leaves all objects to be traversed by the atomic phase:
1544** That avoids traversing twice some objects, such as theads and 1544** That avoids traversing twice some objects, such as threads and
1545** weak tables. 1545** weak tables.
1546*/ 1546*/
1547static l_obj singlestep (lua_State *L, int fast) { 1547static l_obj singlestep (lua_State *L, int fast) {
diff --git a/lgc.h b/lgc.h
index 5e474114..72d318ca 100644
--- a/lgc.h
+++ b/lgc.h
@@ -135,7 +135,7 @@
135** 135**
136** To keep its invariants, the generational mode uses the same barriers 136** To keep its invariants, the generational mode uses the same barriers
137** also used by the incremental mode. If a young object is caught in a 137** also used by the incremental mode. If a young object is caught in a
138** foward barrier, it cannot become old immediately, because it can 138** forward barrier, it cannot become old immediately, because it can
139** still point to other young objects. Instead, it becomes 'old0', 139** still point to other young objects. Instead, it becomes 'old0',
140** which in the next cycle becomes 'old1'. So, 'old0' objects is 140** which in the next cycle becomes 'old1'. So, 'old0' objects is
141** old but can point to new and survival objects; 'old1' is old 141** old but can point to new and survival objects; 'old1' is old
diff --git a/lstate.h b/lstate.h
index 7f567453..2ff0d02b 100644
--- a/lstate.h
+++ b/lstate.h
@@ -259,7 +259,7 @@ typedef struct global_State {
259 l_obj totalobjs; /* total number of objects allocated + GCdebt */ 259 l_obj totalobjs; /* total number of objects allocated + GCdebt */
260 l_obj GCdebt; /* objects counted but not yet allocated */ 260 l_obj GCdebt; /* objects counted but not yet allocated */
261 l_obj marked; /* number of objects marked in a GC cycle */ 261 l_obj marked; /* number of objects marked in a GC cycle */
262 l_obj GCmajorminor; /* auxiliar counter to control major-minor shifts */ 262 l_obj GCmajorminor; /* auxiliary counter to control major-minor shifts */
263 stringtable strt; /* hash table for strings */ 263 stringtable strt; /* hash table for strings */
264 TValue l_registry; 264 TValue l_registry;
265 TValue nilvalue; /* a nil value */ 265 TValue nilvalue; /* a nil value */
diff --git a/lua.c b/lua.c
index 6a9bb948..9d347d75 100644
--- a/lua.c
+++ b/lua.c
@@ -211,7 +211,7 @@ static int dostring (lua_State *L, const char *s, const char *name) {
211/* 211/*
212** Receives 'globname[=modname]' and runs 'globname = require(modname)'. 212** Receives 'globname[=modname]' and runs 'globname = require(modname)'.
213** If there is no explicit modname and globname contains a '-', cut 213** If there is no explicit modname and globname contains a '-', cut
214** the sufix after '-' (the "version") to make the global name. 214** the suffix after '-' (the "version") to make the global name.
215*/ 215*/
216static int dolibrary (lua_State *L, char *globname) { 216static int dolibrary (lua_State *L, char *globname) {
217 int status; 217 int status;
@@ -230,7 +230,7 @@ static int dolibrary (lua_State *L, char *globname) {
230 status = docall(L, 1, 1); /* call 'require(modname)' */ 230 status = docall(L, 1, 1); /* call 'require(modname)' */
231 if (status == LUA_OK) { 231 if (status == LUA_OK) {
232 if (suffix != NULL) /* is there a suffix mark? */ 232 if (suffix != NULL) /* is there a suffix mark? */
233 *suffix = '\0'; /* remove sufix from global name */ 233 *suffix = '\0'; /* remove suffix from global name */
234 lua_setglobal(L, globname); /* globname = require(modname) */ 234 lua_setglobal(L, globname); /* globname = require(modname) */
235 } 235 }
236 return report(L, status); 236 return report(L, status);
diff --git a/luaconf.h b/luaconf.h
index acebe29c..33bb580d 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -261,7 +261,7 @@
261/* 261/*
262** LUA_IGMARK is a mark to ignore all after it when building the 262** LUA_IGMARK is a mark to ignore all after it when building the
263** module name (e.g., used to build the luaopen_ function name). 263** module name (e.g., used to build the luaopen_ function name).
264** Typically, the sufix after the mark is the module version, 264** Typically, the suffix after the mark is the module version,
265** as in "mod-v1.2.so". 265** as in "mod-v1.2.so".
266*/ 266*/
267#define LUA_IGMARK "-" 267#define LUA_IGMARK "-"
diff --git a/lvm.c b/lvm.c
index 37023afb..88f8fe27 100644
--- a/lvm.c
+++ b/lvm.c
@@ -92,10 +92,10 @@ static int l_strton (const TValue *obj, TValue *result) {
92 if (!cvt2num(obj)) /* is object not a string? */ 92 if (!cvt2num(obj)) /* is object not a string? */
93 return 0; 93 return 0;
94 else { 94 else {
95 TString *st = tsvalue(obj); 95 TString *st = tsvalue(obj);
96 size_t stlen; 96 size_t stlen;
97 const char *s = getlstr(st, stlen); 97 const char *s = getlstr(st, stlen);
98 return (luaO_str2num(s, result) == stlen + 1); 98 return (luaO_str2num(s, result) == stlen + 1);
99 } 99 }
100} 100}
101 101
diff --git a/manual/manual.of b/manual/manual.of
index 7df32fcf..5aea2623 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -289,7 +289,7 @@ Whenever there is an error,
289an @def{error object} 289an @def{error object}
290is propagated with information about the error. 290is propagated with information about the error.
291Lua itself only generates errors whose error object is a string, 291Lua itself only generates errors whose error object is a string,
292but programs may generate errors with 292but programs can generate errors with
293any value as the error object. 293any value as the error object.
294It is up to the Lua program or its host to handle such error objects. 294It is up to the Lua program or its host to handle such error objects.
295For historical reasons, 295For historical reasons,
@@ -298,7 +298,7 @@ even though it does not have to be a string.
298 298
299 299
300When you use @Lid{xpcall} (or @Lid{lua_pcall}, in C) 300When you use @Lid{xpcall} (or @Lid{lua_pcall}, in C)
301you may give a @def{message handler} 301you can give a @def{message handler}
302to be called in case of errors. 302to be called in case of errors.
303This function is called with the original error object 303This function is called with the original error object
304and returns a new error object. 304and returns a new error object.
@@ -343,7 +343,7 @@ which is then called a @def{metamethod}.
343In the previous example, the key is the string @St{__add} 343In the previous example, the key is the string @St{__add}
344and the metamethod is the function that performs the addition. 344and the metamethod is the function that performs the addition.
345Unless stated otherwise, 345Unless stated otherwise,
346a metamethod may in fact be any @x{callable value}, 346a metamethod can in fact be any @x{callable value},
347which is either a function or a value with a @idx{__call} metamethod. 347which is either a function or a value with a @idx{__call} metamethod.
348 348
349You can query the metatable of any value 349You can query the metatable of any value
@@ -1421,7 +1421,7 @@ labels in Lua are considered statements too:
1421 1421
1422A label is visible in the entire block where it is defined, 1422A label is visible in the entire block where it is defined,
1423except inside nested functions. 1423except inside nested functions.
1424A goto may jump to any visible label as long as it does not 1424A goto can jump to any visible label as long as it does not
1425enter into the scope of a local variable. 1425enter into the scope of a local variable.
1426A label should not be declared 1426A label should not be declared
1427where a label with the same name is visible, 1427where a label with the same name is visible,
@@ -4549,7 +4549,7 @@ corresponding Lua value is removed from the stack @see{constchar}.
4549 4549
4550This function can raise memory errors only 4550This function can raise memory errors only
4551when converting a number to a string 4551when converting a number to a string
4552(as then it may have to create a new string). 4552(as then it may create a new string).
4553 4553
4554} 4554}
4555 4555
@@ -6113,8 +6113,8 @@ The metatable is created by the I/O library
6113 6113
6114This userdata must start with the structure @id{luaL_Stream}; 6114This userdata must start with the structure @id{luaL_Stream};
6115it can contain other data after this initial structure. 6115it can contain other data after this initial structure.
6116The field @id{f} points to the corresponding C stream 6116The field @id{f} points to the corresponding C stream,
6117(or it can be @id{NULL} to indicate an incompletely created handle). 6117or it is @id{NULL} to indicate an incompletely created handle.
6118The field @id{closef} points to a Lua function 6118The field @id{closef} points to a Lua function
6119that will be called to close the stream 6119that will be called to close the stream
6120when the handle is closed or collected; 6120when the handle is closed or collected;
@@ -9239,11 +9239,25 @@ Lua repeatedly prompts and waits for a line.
9239After reading a line, 9239After reading a line,
9240Lua first try to interpret the line as an expression. 9240Lua first try to interpret the line as an expression.
9241If it succeeds, it prints its value. 9241If it succeeds, it prints its value.
9242Otherwise, it interprets the line as a statement. 9242Otherwise, it interprets the line as a chunk.
9243If you write an incomplete statement, 9243If you write an incomplete chunk,
9244the interpreter waits for its completion 9244the interpreter waits for its completion
9245by issuing a different prompt. 9245by issuing a different prompt.
9246 9246
9247Note that, as each complete line is read as a new chunk,
9248local variables do not outlive lines:
9249@verbatim{
9250> x = 20
9251> local x = 10; print(x) --> 10
9252> print(x) --> 20 -- global 'x'
9253> do -- incomplete line
9254>> local x = 10; print(x) -- '>>' prompts for line completion
9255>> print(x)
9256>> end -- line completed; Lua will run it as a single chunk
9257 --> 10
9258 --> 10
9259}
9260
9247If the global variable @defid{_PROMPT} contains a string, 9261If the global variable @defid{_PROMPT} contains a string,
9248then its value is used as the prompt. 9262then its value is used as the prompt.
9249Similarly, if the global variable @defid{_PROMPT2} contains a string, 9263Similarly, if the global variable @defid{_PROMPT2} contains a string,
diff --git a/testes/pm.lua b/testes/pm.lua
index 44454dff..f5889fcd 100644
--- a/testes/pm.lua
+++ b/testes/pm.lua
@@ -56,7 +56,8 @@ assert(f(" \n\r*&\n\r xuxu \n\n", "%g%g%g+") == "xuxu")
56 56
57-- Adapt a pattern to UTF-8 57-- Adapt a pattern to UTF-8
58local function PU (p) 58local function PU (p)
59 -- break '?' into each individual byte of a character 59 -- distribute '?' into each individual byte of a character.
60 -- (For instance, "รก?" becomes "\195?\161?".)
60 p = string.gsub(p, "(" .. utf8.charpattern .. ")%?", function (c) 61 p = string.gsub(p, "(" .. utf8.charpattern .. ")%?", function (c)
61 return string.gsub(c, ".", "%0?") 62 return string.gsub(c, ".", "%0?")
62 end) 63 end)