aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-16 14:58:02 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-16 14:58:02 -0300
commitb96b0b5abbf40cbdbed7952bf35a5a27ddf75928 (patch)
tree5d9d5463cb7d3424833abab20dd87bce1f4b240f /lauxlib.c
parentca13be9af784b7288d3a07d9b5bccb329086e885 (diff)
downloadlua-b96b0b5abbf40cbdbed7952bf35a5a27ddf75928.tar.gz
lua-b96b0b5abbf40cbdbed7952bf35a5a27ddf75928.tar.bz2
lua-b96b0b5abbf40cbdbed7952bf35a5a27ddf75928.zip
Added macro 'luaL_pushfail'
The macro 'luaL_pushfail' documents all places in the standard libraries that return nil to signal some kind of failure. It is defined as 'lua_pushnil'. The manual also got a notation (@fail) to document those returns. The tests were changed to be agnostic regarding whether 'fail' is 'nil' or 'false'.
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 014e7052..5a040ac6 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -249,7 +249,7 @@ LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) {
249 return 1; 249 return 1;
250 } 250 }
251 else { 251 else {
252 lua_pushnil(L); 252 luaL_pushfail(L);
253 if (fname) 253 if (fname)
254 lua_pushfstring(L, "%s: %s", fname, strerror(en)); 254 lua_pushfstring(L, "%s: %s", fname, strerror(en));
255 else 255 else
@@ -291,10 +291,10 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) {
291 if (*what == 'e' && stat == 0) /* successful termination? */ 291 if (*what == 'e' && stat == 0) /* successful termination? */
292 lua_pushboolean(L, 1); 292 lua_pushboolean(L, 1);
293 else 293 else
294 lua_pushnil(L); 294 luaL_pushfail(L);
295 lua_pushstring(L, what); 295 lua_pushstring(L, what);
296 lua_pushinteger(L, stat); 296 lua_pushinteger(L, stat);
297 return 3; /* return true/nil,what,code */ 297 return 3; /* return true/fail,what,code */
298 } 298 }
299} 299}
300 300