[vlc-commits] commit: Lua: Misc simplifications. (Antoine Cellerier )

git version control git at videolan.org
Tue Mar 2 21:24:59 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Tue Mar  2 14:33:11 2010 +0100| [874015cce397cd25d400e64b4879774a1cde92aa] | committer: Antoine Cellerier 

Lua: Misc simplifications.

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

 modules/misc/lua/libs/dialog.c |    8 +++-----
 modules/misc/lua/meta.c        |    9 ++++-----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/misc/lua/libs/dialog.c b/modules/misc/lua/libs/dialog.c
index 906e63e..0cddd30 100644
--- a/modules/misc/lua/libs/dialog.c
+++ b/modules/misc/lua/libs/dialog.c
@@ -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;
 
diff --git a/modules/misc/lua/meta.c b/modules/misc/lua/meta.c
index a56fd09..9c8e943 100644
--- a/modules/misc/lua/meta.c
+++ b/modules/misc/lua/meta.c
@@ -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 );



More information about the vlc-commits mailing list