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 )
{
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;
......
......@@ -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 );
......
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