From 80447c36541ed18d9635d94328258552a6ad0240 Mon Sep 17 00:00:00 2001 From: sigatrev Date: Sat, 16 Aug 2014 10:55:14 -0500 Subject: [PATCH] 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. --- src/ActorFrame.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index 845acd41eb..0660ff79d3 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -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;