aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-31 17:53:01 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-31 17:53:01 -0200
commitb68fb7f62e1475e28a4cb27569e8b659f925e114 (patch)
treef6f68d64789b0970fbc2ec4dcc74de5ab9f23b13
parent60ff79451c32e1e6dbec001846871aa878c43289 (diff)
downloadlua-b68fb7f62e1475e28a4cb27569e8b659f925e114.tar.gz
lua-b68fb7f62e1475e28a4cb27569e8b659f925e114.tar.bz2
lua-b68fb7f62e1475e28a4cb27569e8b659f925e114.zip
`assert' returns its first argument
-rw-r--r--lbaselib.c5
-rw-r--r--manual.tex8
2 files changed, 8 insertions, 5 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 669e8e87..997dcb84 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.18 2001/01/10 16:58:11 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.19 2001/01/25 16:45:36 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -404,7 +404,8 @@ static int luaB_assert (lua_State *L) {
404 luaL_checkany(L, 1); 404 luaL_checkany(L, 1);
405 if (lua_isnil(L, 1)) 405 if (lua_isnil(L, 1))
406 luaL_verror(L, "assertion failed! %.90s", luaL_opt_string(L, 2, "")); 406 luaL_verror(L, "assertion failed! %.90s", luaL_opt_string(L, 2, ""));
407 return 0; 407 lua_settop(L, 1);
408 return 1;
408} 409}
409 410
410 411
diff --git a/manual.tex b/manual.tex
index 5d363702..6e1d490f 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.47 2000/12/28 17:25:45 roberto Exp roberto $ 1% $Id: manual.tex,v 1.48 2001/01/29 19:33:55 roberto Exp roberto $
2 2
3\documentclass[11pt]{article} 3\documentclass[11pt]{article}
4\usepackage{fullpage} 4\usepackage{fullpage}
@@ -134,7 +134,7 @@ Waldemar Celes
134\tecgraf\ --- Computer Science Department --- PUC-Rio 134\tecgraf\ --- Computer Science Department --- PUC-Rio
135} 135}
136 136
137\date{{\small \tt\$Date: 2000/12/28 17:25:45 $ $}} 137\date{{\small \tt\$Date: 2001/01/29 19:33:55 $ $}}
138 138
139\maketitle 139\maketitle
140 140
@@ -2436,7 +2436,8 @@ to change the way such messages are shown
2436 2436
2437\subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert} 2437\subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert}
2438Issues an \emph{``assertion failed!''} error 2438Issues an \emph{``assertion failed!''} error
2439when its argument \verb|v| is \nil. 2439when its argument \verb|v| is \nil;
2440otherwise, returns this argument.
2440This function is equivalent to the following Lua function: 2441This function is equivalent to the following Lua function:
2441\begin{verbatim} 2442\begin{verbatim}
2442 function assert (v, m) 2443 function assert (v, m)
@@ -2444,6 +2445,7 @@ This function is equivalent to the following Lua function:
2444 m = m or "" 2445 m = m or ""
2445 error("assertion failed! " .. m) 2446 error("assertion failed! " .. m)
2446 end 2447 end
2448 return v
2447 end 2449 end
2448\end{verbatim} 2450\end{verbatim}
2449 2451