[vlc-commits] lua: use var_ToggleBool.

Rémi Duraffort git at videolan.org
Tue Oct 25 01:13:38 CEST 2011


vlc/vlc-1.1 | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Nov  2 17:27:59 2010 +0100| [49b302c5c858d77f78f25806eea9d1ff3b539a53] | committer: Pierre Ynard

lua: use var_ToggleBool.
(cherry picked from commit a50d13ab0ce72363e9ca37ca305fadf171729b64)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

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

 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 8f2dc27..e2aac27 100644
--- a/modules/misc/lua/libs/variables.c
+++ b/modules/misc/lua/libs/variables.c
@@ -256,16 +256,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