[vlc-devel] [PATCH] Change goto to gotoitem for lua 5.2 compatibility.

Kelly Anderson kelly at silka.with-linux.com
Fri Jan 6 14:54:20 CET 2012


On 01/06/2012 06:47 AM, Rafaël Carré wrote:
> Le 2012-01-06 08:46, Kelly Anderson a écrit :
>> I think this should do it.
>>
>> ---
>>   modules/lua/libs/playlist.c             |    4 ++--
>>   share/lua/intf/cli.lua                  |    3 ++-
>>   share/lua/intf/modules/httprequests.lua |    4 ++--
>>   3 files changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/modules/lua/libs/playlist.c b/modules/lua/libs/playlist.c
>> index 2336a37..c95ce5a 100644
>> --- a/modules/lua/libs/playlist.c
>> +++ b/modules/lua/libs/playlist.c
>> @@ -123,7 +123,7 @@ static int vlclua_playlist_random( lua_State * L )
>>       return i_ret;
>>   }
>>
>> -static int vlclua_playlist_goto( lua_State * L )
>> +static int vlclua_playlist_gotoitem( lua_State * L )
>>   {
>>       int i_id = luaL_checkint( L, 1 );
>>       playlist_t *p_playlist = vlclua_get_playlist_internal( L );
>> @@ -377,7 +377,7 @@ static const luaL_Reg vlclua_playlist_reg[] = {
>>       { "repeat_", vlclua_playlist_repeat }, // ... provide repeat_ too.
>>       { "loop", vlclua_playlist_loop },
>>       { "random", vlclua_playlist_random },
>> -    { "goto", vlclua_playlist_goto },
>> +    { "gotoitem", vlclua_playlist_gotoitem },
> No, "goto" is fine.

I'm pretty sure that I'm not wrong on that one.
That is the lua call that matches up vlc.playlist.* functions to their c 
code implementations.
We don't want to use goto there, since in the lua files you'd be using 
vlc.playlist.goto,
which is going to bork on 5.2.

>
>>       { "add", vlclua_playlist_add },
>>       { "enqueue", vlclua_playlist_enqueue },
>>       { "get", vlclua_playlist_get },
>> diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
>> index 265b938..7185098 100644
>> --- a/share/lua/intf/cli.lua
>> +++ b/share/lua/intf/cli.lua
>> @@ -535,7 +535,8 @@ commands_ordered = {
>>       { "stop"; { func = skip2(vlc.playlist.stop); help = "stop stream" } };
>>       { "next"; { func = skip2(vlc.playlist.next); help = "next playlist item" } };
>>       { "prev"; { func = skip2(vlc.playlist.prev); help = "previous playlist item" } };
>> -    { "goto"; { func = skip2(vlc.playlist.goto); help = "goto item at index" } };
>> +    { "goto"; { func = skip2(vlc.playlist.gotoitem); help = "goto item at index" } };
>> +    { "gotoitem"; { func = skip2(vlc.playlist.gotoitem); help = "goto item at index" } };
>>       { "repeat"; { func = skip2(vlc.playlist.repeat_); args = "[on|off]"; help = "toggle playlist repeat" } };
>>       { "loop"; { func = skip2(vlc.playlist.loop); args = "[on|off]"; help = "toggle playlist loop" } };
>>       { "random"; { func = skip2(vlc.playlist.random); args = "[on|off]"; help = "toggle playlist random" } };
>> diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
>> index 407ab3e..56805ab 100644
>> --- a/share/lua/intf/modules/httprequests.lua
>> +++ b/share/lua/intf/modules/httprequests.lua
>> @@ -93,14 +93,14 @@ processcommands = function ()
>>         if id == -1 then
>>           vlc.playlist.play()
>>         else
>> -        vlc.playlist.goto(id)
>> +        vlc.playlist.gotoitem(id)
>>         end
>>       elseif command == "pl_pause" then
>>         if vlc.playlist.status() == "stopped" then
>>           if id == -1 then
>>             vlc.playlist.play()
>>           else
>> -          vlc.playlist.goto(id)
>> +          vlc.playlist.gotoitem(id)
>>           end
>>         else
>>           vlc.playlist.pause()
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list