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'.
This commit is contained in:
@@ -744,7 +744,7 @@ static int str_find_aux (lua_State *L, int find) {
|
||||
const char *p = luaL_checklstring(L, 2, &lp);
|
||||
size_t init = posrelatI(luaL_optinteger(L, 3, 1), ls) - 1;
|
||||
if (init > ls) { /* start after string's end? */
|
||||
lua_pushnil(L); /* cannot find anything */
|
||||
luaL_pushfail(L); /* cannot find anything */
|
||||
return 1;
|
||||
}
|
||||
/* explicit request or no special characters? */
|
||||
@@ -779,7 +779,7 @@ static int str_find_aux (lua_State *L, int find) {
|
||||
}
|
||||
} while (s1++ < ms.src_end && !anchor);
|
||||
}
|
||||
lua_pushnil(L); /* not found */
|
||||
luaL_pushfail(L); /* not found */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user