Allow Update and Draw functions to be turned off

allow nil to be passed as an argument to SetUpdateFunction and SetDrawFunction to turn off said functions.
This commit is contained in:
sigatrev
2014-08-16 10:55:14 -05:00
parent 4ac7e2ad2d
commit 80447c3654
+18
View File
@@ -632,6 +632,15 @@ public:
static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; }
static int SetDrawFunction( T* p, lua_State *L )
{
if(lua_isnil(L,1))
{
LuaReference ref;
lua_pushnil( L );
ref.SetFromStack( L );
p->SetDrawFunction( ref );
return 0;
}
luaL_checktype( L, 1, LUA_TFUNCTION );
LuaReference ref;
@@ -647,6 +656,15 @@ public:
}
static int SetUpdateFunction( T* p, lua_State *L )
{
if(lua_isnil(L,1))
{
LuaReference ref;
lua_pushnil( L );
ref.SetFromStack( L );
p->SetUpdateFunction( ref );
return 0;
}
luaL_checktype( L, 1, LUA_TFUNCTION );
LuaReference ref;