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 /lmathlib.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 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -77,7 +77,7 @@ static int math_toint (lua_State *L) { | |||
77 | lua_pushinteger(L, n); | 77 | lua_pushinteger(L, n); |
78 | else { | 78 | else { |
79 | luaL_checkany(L, 1); | 79 | luaL_checkany(L, 1); |
80 | lua_pushnil(L); /* value is not convertible to integer */ | 80 | luaL_pushfail(L); /* value is not convertible to integer */ |
81 | } | 81 | } |
82 | return 1; | 82 | return 1; |
83 | } | 83 | } |
@@ -235,7 +235,7 @@ static int math_type (lua_State *L) { | |||
235 | lua_pushstring(L, (lua_isinteger(L, 1)) ? "integer" : "float"); | 235 | lua_pushstring(L, (lua_isinteger(L, 1)) ? "integer" : "float"); |
236 | else { | 236 | else { |
237 | luaL_checkany(L, 1); | 237 | luaL_checkany(L, 1); |
238 | lua_pushnil(L); | 238 | luaL_pushfail(L); |
239 | } | 239 | } |
240 | return 1; | 240 | return 1; |
241 | } | 241 | } |