]> git.sesse.net Git - vlc/commitdiff
Lua: Misc simplifications.
authorAntoine Cellerier <dionoea@videolan.org>
Tue, 2 Mar 2010 13:33:11 +0000 (14:33 +0100)
committerAntoine Cellerier <dionoea@videolan.org>
Tue, 2 Mar 2010 20:27:05 +0000 (21:27 +0100)
modules/misc/lua/libs/dialog.c
modules/misc/lua/meta.c

index 906e63e721d97517b0790db008f861105111b825..0cddd3072defb867f21acbaac8400372001a5f9f 100644 (file)
@@ -365,8 +365,7 @@ int lua_DialogFlush( lua_State *L )
 {
     lua_getglobal( L, "vlc" );
     lua_getfield( L, -1, "__dialog" );
-    extension_dialog_t *p_dlg = ( extension_dialog_t* )
-            lua_topointer( L, lua_gettop( L ) );
+    extension_dialog_t *p_dlg = ( extension_dialog_t* )lua_topointer( L, -1 );
 
     if( !p_dlg )
         return VLC_SUCCESS;
@@ -374,8 +373,7 @@ int lua_DialogFlush( lua_State *L )
     int i_ret = VLC_SUCCESS;
     if( lua_GetDialogUpdate( L ) )
     {
-        i_ret = dialog_ExtensionUpdate( vlclua_get_this( L ),
-                                        p_dlg );
+        i_ret = dialog_ExtensionUpdate( vlclua_get_this( L ), p_dlg );
         lua_SetDialogUpdate( L, 0 );
     }
 
@@ -759,7 +757,7 @@ static int vlclua_widget_clear( lua_State *L )
 
     if( p_widget->type != EXTENSION_WIDGET_DROPDOWN
         && p_widget->type != EXTENSION_WIDGET_LIST )
-        return luaL_error( L, "method add_value not valid for this widget" );
+        return luaL_error( L, "method clear not valid for this widget" );
 
     struct extension_widget_value_t *p_value, *p_next;
 
index a56fd091d2f27cd63916d2de8463c8d347b0397e..9c8e943ee1d12010225fa6964c84bde075dd9eb6 100644 (file)
@@ -138,7 +138,6 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
                       void * user_data )
 {
     input_item_t * p_item = user_data;
-    int s;
 
     lua_State *L = init( p_this, p_item, psz_filename );
     if( !L )
@@ -151,13 +150,13 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
         return i_ret;
     }
 
-    if((s = lua_gettop( L )))
+    if(lua_gettop( L ))
     {
         const char * psz_value;
 
-        if( lua_isstring( L, s ) )
+        if( lua_isstring( L, -1 ) )
         {
-            psz_value = lua_tostring( L, s );
+            psz_value = lua_tostring( L, -1 );
             if( psz_value && *psz_value != 0 )
             {
                 lua_Dbg( p_this, "setting arturl: %s", psz_value );
@@ -166,7 +165,7 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
                 return VLC_SUCCESS;
             }
         }
-        else if( !lua_isnil( L, s ) )
+        else if( !lua_isnoneornil( L, -1 ) )
         {
             msg_Err( p_this, "Lua art fetcher script %s: "
                  "didn't return a string", psz_filename );