rename of lua_isnull to lua_isnone

This commit is contained in:
Roberto Ierusalimschy 2001-12-20 19:27:12 -02:00
parent 42754c0f15
commit 09e15692f3
5 changed files with 16 additions and 16 deletions

View File

@ -81,7 +81,7 @@ LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) {
LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) {
if (lua_isnull(L, narg)) {
if (lua_isnone(L, narg)) {
if (len)
*len = (def ? strlen(def) : 0);
return def;
@ -99,7 +99,7 @@ LUALIB_API lua_Number luaL_check_number (lua_State *L, int narg) {
LUALIB_API lua_Number luaL_opt_number (lua_State *L, int narg, lua_Number def) {
if (lua_isnull(L, narg)) return def;
if (lua_isnone(L, narg)) return def;
else return luaL_check_number(L, narg);
}

View File

@ -137,7 +137,7 @@ static int luaB_getglobal (lua_State *L) {
static int luaB_eventtable (lua_State *L) {
luaL_check_type(L, 1, LUA_TTABLE);
if (lua_isnull(L, 2))
if (lua_isnone(L, 2))
lua_geteventtable(L, 1);
else {
lua_settop(L, 2);
@ -174,7 +174,7 @@ static int luaB_weakmode (lua_State *L) {
static int luaB_globals (lua_State *L) {
lua_getglobals(L); /* value to be returned */
if (!lua_isnull(L, 1)) {
if (!lua_isnone(L, 1)) {
luaL_check_type(L, 1, LUA_TTABLE);
lua_pushvalue(L, 1); /* new table of globals */
lua_setglobals(L);
@ -213,7 +213,7 @@ static int luaB_collectgarbage (lua_State *L) {
static int luaB_type (lua_State *L) {
luaL_check_any(L, 1);
if (lua_isnull(L, 2))
if (lua_isnone(L, 2))
lua_pushstring(L, lua_typename(L, lua_type(L, 1)));
else {
lua_pushboolean(L,
@ -362,7 +362,7 @@ static int luaB_call (lua_State *L) {
int err = 0; /* index of old error method */
int status;
int n;
if (!lua_isnull(L, 4)) { /* set new error method */
if (!lua_isnone(L, 4)) { /* set new error method */
lua_getglobal(L, LUA_ERRORMESSAGE);
err = lua_gettop(L); /* get index */
lua_pushvalue(L, 4);
@ -618,7 +618,7 @@ static int luaB_sort (lua_State *L) {
int n;
luaL_check_type(L, 1, LUA_TTABLE);
n = lua_getn(L, 1);
if (!lua_isnull(L, 2)) /* is there a 2nd argument? */
if (!lua_isnone(L, 2)) /* is there a 2nd argument? */
luaL_check_type(L, 2, LUA_TFUNCTION);
lua_settop(L, 2); /* make sure there is two arguments */
auxsort(L, 1, n);

View File

@ -177,7 +177,7 @@ static int io_tmpfile (lua_State *L) {
static int io_fromto (lua_State *L, int inout, const char *mode) {
FILE *current;
if (lua_isnull(L, 1)) {
if (lua_isnone(L, 1)) {
getopthandle(L, inout);
resetfile(L, inout);
return io_close(L);
@ -405,7 +405,7 @@ static int io_seek (lua_State *L) {
static int io_flush (lua_State *L) {
FILE *f = (lua_isnull(L, 1)) ? (FILE *)(NULL) :
FILE *f = (lua_isnone(L, 1)) ? (FILE *)(NULL) :
(FILE *)(luaL_check_userdata(L, 1, FILEHANDLE));
return pushresult(L, fflush(f) == 0);
}
@ -525,7 +525,7 @@ static int io_date (lua_State *L) {
static int io_time (lua_State *L) {
if (lua_isnull(L, 1)) /* called without args? */
if (lua_isnone(L, 1)) /* called without args? */
lua_pushnumber(L, time(NULL)); /* return current time */
else {
time_t t;

View File

@ -225,7 +225,7 @@ static int get_limits (lua_State *L) {
static int mem_query (lua_State *L) {
if (lua_isnull(L, 1)) {
if (lua_isnone(L, 1)) {
lua_pushnumber(L, memdebug_total);
lua_pushnumber(L, memdebug_numblocks);
lua_pushnumber(L, memdebug_maxmem);
@ -239,7 +239,7 @@ static int mem_query (lua_State *L) {
static int hash_query (lua_State *L) {
if (lua_isnull(L, 2)) {
if (lua_isnone(L, 2)) {
luaL_arg_check(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected");
lua_pushnumber(L, tsvalue(luaA_index(L, 1))->tsv.hash);
}
@ -335,7 +335,7 @@ static int unref (lua_State *L) {
static int eventtable (lua_State *L) {
luaL_check_any(L, 1);
if (lua_isnull(L, 2))
if (lua_isnone(L, 2))
lua_geteventtable(L, 1);
else {
lua_settop(L, 2);
@ -429,7 +429,7 @@ static int doremote (lua_State *L) {
}
else {
int i = 0;
while (!lua_isnull(L1, ++i))
while (!lua_isnone(L1, ++i))
lua_pushstring(L, lua_tostring(L1, i));
lua_pop(L1, i-1);
return i-1;
@ -518,7 +518,7 @@ static int testC (lua_State *L) {
lua_pushnumber(L, lua_isnil(L, getnum));
}
else if EQ("isnull") {
lua_pushnumber(L, lua_isnull(L, getnum));
lua_pushnumber(L, lua_isnone(L, getnum));
}
else if EQ("tonumber") {
lua_pushnumber(L, lua_tonumber(L, getnum));

2
lua.h
View File

@ -227,7 +227,7 @@ LUA_API int lua_getweakmode (lua_State *L, int index);
#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA)
#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
#define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN)
#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE)
#define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \
(sizeof(s)/sizeof(char))-1)