`assert' returns its first argument
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lbaselib.c,v 1.18 2001/01/10 16:58:11 roberto Exp roberto $
|
** $Id: lbaselib.c,v 1.19 2001/01/25 16:45:36 roberto Exp roberto $
|
||||||
** Basic library
|
** Basic library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -404,7 +404,8 @@ static int luaB_assert (lua_State *L) {
|
|||||||
luaL_checkany(L, 1);
|
luaL_checkany(L, 1);
|
||||||
if (lua_isnil(L, 1))
|
if (lua_isnil(L, 1))
|
||||||
luaL_verror(L, "assertion failed! %.90s", luaL_opt_string(L, 2, ""));
|
luaL_verror(L, "assertion failed! %.90s", luaL_opt_string(L, 2, ""));
|
||||||
return 0;
|
lua_settop(L, 1);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
% $Id: manual.tex,v 1.47 2000/12/28 17:25:45 roberto Exp roberto $
|
% $Id: manual.tex,v 1.48 2001/01/29 19:33:55 roberto Exp roberto $
|
||||||
|
|
||||||
\documentclass[11pt]{article}
|
\documentclass[11pt]{article}
|
||||||
\usepackage{fullpage}
|
\usepackage{fullpage}
|
||||||
@@ -134,7 +134,7 @@ Waldemar Celes
|
|||||||
\tecgraf\ --- Computer Science Department --- PUC-Rio
|
\tecgraf\ --- Computer Science Department --- PUC-Rio
|
||||||
}
|
}
|
||||||
|
|
||||||
\date{{\small \tt\$Date: 2000/12/28 17:25:45 $ $}}
|
\date{{\small \tt\$Date: 2001/01/29 19:33:55 $ $}}
|
||||||
|
|
||||||
\maketitle
|
\maketitle
|
||||||
|
|
||||||
@@ -2436,7 +2436,8 @@ to change the way such messages are shown
|
|||||||
|
|
||||||
\subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert}
|
\subsubsection*{\ff \T{assert (v [, message])}}\DefLIB{assert}
|
||||||
Issues an \emph{``assertion failed!''} error
|
Issues an \emph{``assertion failed!''} error
|
||||||
when its argument \verb|v| is \nil.
|
when its argument \verb|v| is \nil;
|
||||||
|
otherwise, returns this argument.
|
||||||
This function is equivalent to the following Lua function:
|
This function is equivalent to the following Lua function:
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
function assert (v, m)
|
function assert (v, m)
|
||||||
@@ -2444,6 +2445,7 @@ This function is equivalent to the following Lua function:
|
|||||||
m = m or ""
|
m = m or ""
|
||||||
error("assertion failed! " .. m)
|
error("assertion failed! " .. m)
|
||||||
end
|
end
|
||||||
|
return v
|
||||||
end
|
end
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user