Skip to content

Commit

Permalink
Use lua_isnoneornil() for optional check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neopallium committed Aug 7, 2012
1 parent cb17d84 commit 773979c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions native_objects/gen_lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static FUNC_UNUSED obj_udata *obj_udata_luacheck_internal(lua_State *L, int _ind
return ud;
}
}
} else if(!lua_isnil(L, _index)) {
} else if(!lua_isnoneornil(L, _index)) {
/* handle cdata. */
/* get private table. */
lua_pushlightuserdata(L, obj_udata_private_key);
Expand Down Expand Up @@ -367,7 +367,7 @@ static FUNC_UNUSED void *obj_udata_luacheck(lua_State *L, int _index, obj_type *
static FUNC_UNUSED void *obj_udata_luaoptional(lua_State *L, int _index, obj_type *type) {
void *obj = NULL;
if(lua_gettop(L) < _index || lua_isnil(L, _index)) {
if(lua_isnoneornil(L, _index)) {
return obj;
}
obj_udata_luacheck_internal(L, _index, &(obj), type, 1);
Expand Down Expand Up @@ -557,7 +557,7 @@ static FUNC_UNUSED void * obj_simple_udata_luacheck(lua_State *L, int _index, ob
return ud;
}
}
} else if(!lua_isnil(L, _index)) {
} else if(!lua_isnoneornil(L, _index)) {
/* handle cdata. */
/* get private table. */
lua_pushlightuserdata(L, obj_udata_private_key);
Expand All @@ -583,7 +583,7 @@ static FUNC_UNUSED void * obj_simple_udata_luacheck(lua_State *L, int _index, ob
}
static FUNC_UNUSED void * obj_simple_udata_luaoptional(lua_State *L, int _index, obj_type *type) {
if(lua_gettop(L) < _index || lua_isnil(L, _index)) {
if(lua_isnoneornil(L, _index)) {
return NULL;
}
return obj_simple_udata_luacheck(L, _index, type);
Expand Down Expand Up @@ -857,7 +857,7 @@ static FUNC_UNUSED bool obj_implement_luaoptional(lua_State *L, int _index, obj_
char *if_name)
{
void *ud;
if(lua_gettop(L) < _index || lua_isnil(L, _index)) {
if(lua_isnoneornil(L, _index)) {
return false;
}
/* get the implements table for this interface. */
Expand Down

0 comments on commit 773979c

Please sign in to comment.