diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-12-11 11:54:14 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-12-11 11:54:14 -0200 |
commit | 3b06f983ae0e57b90cdeb500c84bb524e5c3635b (patch) | |
tree | 7325ada043c7c2f0a2641bb0d6bfd9b16b002850 /lbaselib.c | |
parent | 51316f9df7aacb54633a3e9b910a070590ac6259 (diff) | |
download | lua-3b06f983ae0e57b90cdeb500c84bb524e5c3635b.tar.gz lua-3b06f983ae0e57b90cdeb500c84bb524e5c3635b.tar.bz2 lua-3b06f983ae0e57b90cdeb500c84bb524e5c3635b.zip |
Details
- in 'luaB_tonumber', do not need to "checkany" when argument
is a number.
- in 'lua_resume', the call to 'luaD_rawrunprotected' cannot return
a status equal to -1.
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -68,7 +68,6 @@ static const char *b_str2int (const char *s, int base, lua_Integer *pn) { | |||
68 | 68 | ||
69 | static int luaB_tonumber (lua_State *L) { | 69 | static int luaB_tonumber (lua_State *L) { |
70 | if (lua_isnoneornil(L, 2)) { /* standard conversion? */ | 70 | if (lua_isnoneornil(L, 2)) { /* standard conversion? */ |
71 | luaL_checkany(L, 1); | ||
72 | if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ | 71 | if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ |
73 | lua_settop(L, 1); /* yes; return it */ | 72 | lua_settop(L, 1); /* yes; return it */ |
74 | return 1; | 73 | return 1; |
@@ -79,6 +78,7 @@ static int luaB_tonumber (lua_State *L) { | |||
79 | if (s != NULL && lua_stringtonumber(L, s) == l + 1) | 78 | if (s != NULL && lua_stringtonumber(L, s) == l + 1) |
80 | return 1; /* successful conversion to number */ | 79 | return 1; /* successful conversion to number */ |
81 | /* else not a number */ | 80 | /* else not a number */ |
81 | luaL_checkany(L, 1); /* (but there must be some parameter) */ | ||
82 | } | 82 | } |
83 | } | 83 | } |
84 | else { | 84 | else { |