[vlc-commits] commit: lua: use var_ToggleBool. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Tue Nov 2 17:44:59 CET 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Nov  2 17:27:59 2010 +0100| [a50d13ab0ce72363e9ca37ca305fadf171729b64] | committer: Rémi Duraffort 

lua: use var_ToggleBool.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a50d13ab0ce72363e9ca37ca305fadf171729b64
---

 modules/misc/lua/libs/variables.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/misc/lua/libs/variables.c b/modules/misc/lua/libs/variables.c
index a365b89..b2bfb07 100644
--- a/modules/misc/lua/libs/variables.c
+++ b/modules/misc/lua/libs/variables.c
@@ -254,16 +254,15 @@ int __vlclua_var_toggle_or_set( lua_State *L, vlc_object_t *p_obj,
     if( lua_gettop( L ) > 1 ) return vlclua_error( L );
 
     if( lua_gettop( L ) == 0 )
-        b_bool = !var_GetBool( p_obj, psz_name );
+        b_bool = var_ToggleBool( p_obj, psz_name );
     else /* lua_gettop( L ) == 1 */
     {
         b_bool = luaL_checkboolean( L, -1 );
         lua_pop( L, 1 );
+        if( b_bool != var_GetBool( p_obj, psz_name ) )
+            var_SetBool( p_obj, psz_name, b_bool );
     }
 
-    if( b_bool != var_GetBool( p_obj, psz_name ) )
-        var_SetBool( p_obj, psz_name, b_bool );
-
     lua_pushboolean( L, b_bool );
     return 1;
 }



More information about the vlc-commits mailing list