when possible, library functions accept nil as none

This commit is contained in:
Roberto Ierusalimschy
2002-03-27 12:30:41 -03:00
parent 405e3a4597
commit d1f220217b
5 changed files with 13 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lbaselib.c,v 1.60 2002/03/20 12:54:08 roberto Exp roberto $
** $Id: lbaselib.c,v 1.61 2002/03/27 12:49:53 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -620,7 +620,7 @@ static void set2 (lua_State *L, int i, int j) {
static int sort_comp (lua_State *L, int a, int b) {
/* WARNING: the caller (auxsort) must ensure stack space */
if (!lua_isnil(L, 2)) { /* function? */
if (!lua_isnoneornil(L, 2)) { /* function? */
int res;
lua_pushvalue(L, 2);
lua_pushvalue(L, a-1); /* -1 to compensate function */