aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-09-07 15:59:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-09-07 15:59:59 -0300
commitce9609296ce5d761e58af4cccdab6ca925613bea (patch)
tree0613054791c3c900a651d77a678672f811b075b2
parentb1450721be39b9cb7b60144ec5115e379c56de77 (diff)
downloadlua-ce9609296ce5d761e58af4cccdab6ca925613bea.tar.gz
lua-ce9609296ce5d761e58af4cccdab6ca925613bea.tar.bz2
lua-ce9609296ce5d761e58af4cccdab6ca925613bea.zip
function "luaL_argerror" prints wrong argument number (from a user's point
of view) when functions have upvalues.
-rw-r--r--bugs9
-rw-r--r--lauxlib.c9
-rw-r--r--liolib.c8
3 files changed, 17 insertions, 9 deletions
diff --git a/bugs b/bugs
index 63a8acd6..64bc69d7 100644
--- a/bugs
+++ b/bugs
@@ -31,7 +31,7 @@ Tue Jan 27 17:12:36 EDT 1998
31 31
32** lstring.c / ltable.c 32** lstring.c / ltable.c
33Wed Jan 28 14:48:12 EDT 1998 33Wed Jan 28 14:48:12 EDT 1998
34>> tables can become full of "emptys" slots, and keep growing without limits. 34>> tables can become full of "empty" slots, and keep growing without limits.
35 35
36** lstrlib.c 36** lstrlib.c
37Mon Mar 9 15:26:09 EST 1998 37Mon Mar 9 15:26:09 EST 1998
@@ -41,3 +41,10 @@ Mon Mar 9 15:26:09 EST 1998
41Mon May 18 19:20:00 EST 1998 41Mon May 18 19:20:00 EST 1998
42>> arguments for "format" 'x', 'X', 'o' and 'u' must be unsigned int. 42>> arguments for "format" 'x', 'X', 'o' and 'u' must be unsigned int.
43 43
44
45--- Version 3.1
46
47** liolib.c / lauxlib.c
48Mon Sep 7 15:57:02 EST 1998
49>> function "luaL_argerror" prints wrong argument number (from a user's point
50of view) when functions have upvalues.
diff --git a/lauxlib.c b/lauxlib.c
index 415c4fea..c8c1f3d6 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.11 1998/06/18 16:57:03 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.12 1998/06/19 16:14:09 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -27,10 +27,11 @@ int luaL_findstring (char *name, char *list[]) {
27 return -1; /* name not found */ 27 return -1; /* name not found */
28} 28}
29 29
30void luaL_argerror (int numarg, char *extramsg) 30void luaL_argerror (int numarg, char *extramsg) {
31{ 31 lua_Function f = lua_stackedfunction(0);
32 char *funcname; 32 char *funcname;
33 lua_getobjname(lua_stackedfunction(0), &funcname); 33 lua_getobjname(f, &funcname);
34 numarg -= lua_nups(f);
34 if (funcname == NULL) 35 if (funcname == NULL)
35 funcname = "???"; 36 funcname = "???";
36 if (extramsg == NULL) 37 if (extramsg == NULL)
diff --git a/liolib.c b/liolib.c
index 184568f7..2aba847c 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.23 1998/08/24 20:14:56 roberto Exp roberto $ 2** $Id: liolib.c,v 1.24 1998/08/30 20:25:24 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -284,8 +284,8 @@ static void io_seek (void) {
284 FILE *f = getfile(FIRSTARG-1+1); 284 FILE *f = getfile(FIRSTARG-1+1);
285 int op = luaL_findstring(luaL_opt_string(FIRSTARG-1+2, "cur"), modenames); 285 int op = luaL_findstring(luaL_opt_string(FIRSTARG-1+2, "cur"), modenames);
286 long offset = luaL_opt_number(FIRSTARG-1+3, 0); 286 long offset = luaL_opt_number(FIRSTARG-1+3, 0);
287 luaL_arg_check(f, 1, "invalid file handler"); 287 luaL_arg_check(f, FIRSTARG-1+1, "invalid file handler");
288 luaL_arg_check(op != -1, 2, "invalid mode"); 288 luaL_arg_check(op != -1, FIRSTARG-1+2, "invalid mode");
289 op = fseek(f, offset, mode[op]); 289 op = fseek(f, offset, mode[op]);
290 if (op) 290 if (op)
291 pushresult(0); /* error */ 291 pushresult(0); /* error */
@@ -296,7 +296,7 @@ static void io_seek (void) {
296 296
297static void io_flush (void) { 297static void io_flush (void) {
298 FILE *f = getfile(FIRSTARG); 298 FILE *f = getfile(FIRSTARG);
299 luaL_arg_check(f || lua_getparam(FIRSTARG) == LUA_NOOBJECT, 1, 299 luaL_arg_check(f || lua_getparam(FIRSTARG) == LUA_NOOBJECT, FIRSTARG,
300 "invalid file handler"); 300 "invalid file handler");
301 pushresult(fflush(f) == 0); 301 pushresult(fflush(f) == 0);
302} 302}