diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-16 14:58:02 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-16 14:58:02 -0300 |
| commit | b96b0b5abbf40cbdbed7952bf35a5a27ddf75928 (patch) | |
| tree | 5d9d5463cb7d3424833abab20dd87bce1f4b240f /lbaselib.c | |
| parent | ca13be9af784b7288d3a07d9b5bccb329086e885 (diff) | |
| download | lua-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 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -106,7 +106,7 @@ static int luaB_tonumber (lua_State *L) { | |||
| 106 | return 1; | 106 | return 1; |
| 107 | } /* else not a number */ | 107 | } /* else not a number */ |
| 108 | } /* else not a number */ | 108 | } /* else not a number */ |
| 109 | lua_pushnil(L); /* not a number */ | 109 | luaL_pushfail(L); /* not a number */ |
| 110 | return 1; | 110 | return 1; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| @@ -308,9 +308,9 @@ static int load_aux (lua_State *L, int status, int envidx) { | |||
| 308 | return 1; | 308 | return 1; |
| 309 | } | 309 | } |
| 310 | else { /* error (message is on top of the stack) */ | 310 | else { /* error (message is on top of the stack) */ |
| 311 | lua_pushnil(L); | 311 | luaL_pushfail(L); |
| 312 | lua_insert(L, -2); /* put before error message */ | 312 | lua_insert(L, -2); /* put before error message */ |
| 313 | return 2; /* return nil plus error message */ | 313 | return 2; /* return fail plus error message */ |
| 314 | } | 314 | } |
| 315 | } | 315 | } |
| 316 | 316 | ||
