Commit 73af7675 authored by Rafaël Carré's avatar Rafaël Carré Committed by Pierre Ynard

fix vlclua_var_toggle_or_set

argument is a string ("on" or "off") not a bool
(cherry picked from commit e292947855ae11068c34a1e27dbf919e3abc85c6)
Signed-off-by: default avatarPierre Ynard <linkfanel@yahoo.fr>
parent 49b302c5
...@@ -256,15 +256,29 @@ int __vlclua_var_toggle_or_set( lua_State *L, vlc_object_t *p_obj, ...@@ -256,15 +256,29 @@ 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 ) > 1 ) return vlclua_error( L );
if( lua_gettop( L ) == 0 ) if( lua_gettop( L ) == 0 )
{
b_bool = var_ToggleBool( p_obj, psz_name ); b_bool = var_ToggleBool( p_obj, psz_name );
else /* lua_gettop( L ) == 1 */ goto end;
}
/* lua_gettop( L ) == 1 */
const char *s = luaL_checkstring( L, -1 );
lua_pop( L, 1 );
if( s && !strcmp(s, "on") )
b_bool = true;
else if( s && !strcmp(s, "off") )
b_bool = false;
else
{ {
b_bool = luaL_checkboolean( L, -1 ); b_bool = var_GetBool( p_obj, psz_name );
lua_pop( L, 1 ); goto end;
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 );
end:
lua_pushboolean( L, b_bool ); lua_pushboolean( L, b_bool );
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment