mirror of https://github.com/rusefi/lua.git
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.
This commit is contained in:
parent
51316f9df7
commit
3b06f983ae
|
@ -68,7 +68,6 @@ static const char *b_str2int (const char *s, int base, lua_Integer *pn) {
|
|||
|
||||
static int luaB_tonumber (lua_State *L) {
|
||||
if (lua_isnoneornil(L, 2)) { /* standard conversion? */
|
||||
luaL_checkany(L, 1);
|
||||
if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */
|
||||
lua_settop(L, 1); /* yes; return it */
|
||||
return 1;
|
||||
|
@ -79,6 +78,7 @@ static int luaB_tonumber (lua_State *L) {
|
|||
if (s != NULL && lua_stringtonumber(L, s) == l + 1)
|
||||
return 1; /* successful conversion to number */
|
||||
/* else not a number */
|
||||
luaL_checkany(L, 1); /* (but there must be some parameter) */
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
5
ldo.c
5
ldo.c
|
@ -678,9 +678,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs,
|
|||
L->nny = 0; /* allow yields */
|
||||
api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
|
||||
status = luaD_rawrunprotected(L, resume, &nargs);
|
||||
if (unlikely(status == -1)) /* error calling 'lua_resume'? */
|
||||
status = LUA_ERRRUN;
|
||||
else { /* continue running after recoverable errors */
|
||||
/* continue running after recoverable errors */
|
||||
while (errorstatus(status) && recover(L, status)) {
|
||||
/* unroll continuation */
|
||||
status = luaD_rawrunprotected(L, unroll, &status);
|
||||
|
@ -694,7 +692,6 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs,
|
|||
L->ci = &L->base_ci; /* back to the original C level */
|
||||
L->ci->top = L->top;
|
||||
}
|
||||
}
|
||||
*nresults = (status == LUA_YIELD) ? L->ci->u2.nyield
|
||||
: cast_int(L->top - (L->ci->func + 1));
|
||||
L->nny = oldnny; /* restore 'nny' */
|
||||
|
|
Loading…
Reference in New Issue