Commit 874015cc authored by Antoine Cellerier's avatar Antoine Cellerier

Lua: Misc simplifications.

parent 4822a79c
...@@ -365,8 +365,7 @@ int lua_DialogFlush( lua_State *L ) ...@@ -365,8 +365,7 @@ int lua_DialogFlush( lua_State *L )
{ {
lua_getglobal( L, "vlc" ); lua_getglobal( L, "vlc" );
lua_getfield( L, -1, "__dialog" ); lua_getfield( L, -1, "__dialog" );
extension_dialog_t *p_dlg = ( extension_dialog_t* ) extension_dialog_t *p_dlg = ( extension_dialog_t* )lua_topointer( L, -1 );
lua_topointer( L, lua_gettop( L ) );
if( !p_dlg ) if( !p_dlg )
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -374,8 +373,7 @@ int lua_DialogFlush( lua_State *L ) ...@@ -374,8 +373,7 @@ int lua_DialogFlush( lua_State *L )
int i_ret = VLC_SUCCESS; int i_ret = VLC_SUCCESS;
if( lua_GetDialogUpdate( L ) ) if( lua_GetDialogUpdate( L ) )
{ {
i_ret = dialog_ExtensionUpdate( vlclua_get_this( L ), i_ret = dialog_ExtensionUpdate( vlclua_get_this( L ), p_dlg );
p_dlg );
lua_SetDialogUpdate( L, 0 ); lua_SetDialogUpdate( L, 0 );
} }
...@@ -759,7 +757,7 @@ static int vlclua_widget_clear( lua_State *L ) ...@@ -759,7 +757,7 @@ static int vlclua_widget_clear( lua_State *L )
if( p_widget->type != EXTENSION_WIDGET_DROPDOWN if( p_widget->type != EXTENSION_WIDGET_DROPDOWN
&& p_widget->type != EXTENSION_WIDGET_LIST ) && 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; struct extension_widget_value_t *p_value, *p_next;
......
...@@ -138,7 +138,6 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename, ...@@ -138,7 +138,6 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
void * user_data ) void * user_data )
{ {
input_item_t * p_item = user_data; input_item_t * p_item = user_data;
int s;
lua_State *L = init( p_this, p_item, psz_filename ); lua_State *L = init( p_this, p_item, psz_filename );
if( !L ) if( !L )
...@@ -151,13 +150,13 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename, ...@@ -151,13 +150,13 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
return i_ret; return i_ret;
} }
if((s = lua_gettop( L ))) if(lua_gettop( L ))
{ {
const char * psz_value; 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 ) if( psz_value && *psz_value != 0 )
{ {
lua_Dbg( p_this, "setting arturl: %s", psz_value ); 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, ...@@ -166,7 +165,7 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
} }
else if( !lua_isnil( L, s ) ) else if( !lua_isnoneornil( L, -1 ) )
{ {
msg_Err( p_this, "Lua art fetcher script %s: " msg_Err( p_this, "Lua art fetcher script %s: "
"didn't return a string", psz_filename ); "didn't return a string", psz_filename );
......
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