Commit df28caa3 authored by Julien 'Lta' BALLET's avatar Julien 'Lta' BALLET Committed by Jean-Baptiste Kempf

Extends lua's SD API to add a remove_node method, similar for remove_item

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0eb37e84
...@@ -319,6 +319,21 @@ static int vlclua_sd_remove_item( lua_State *L ) ...@@ -319,6 +319,21 @@ static int vlclua_sd_remove_item( lua_State *L )
return 1; return 1;
} }
static int vlclua_sd_remove_node( lua_State *L )
{
services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L );
if( !lua_isnil( L, 1 ) )
{
input_item_t **pp_input = luaL_checkudata( L, 1, "node" );
if( *pp_input )
services_discovery_RemoveItem( p_sd, *pp_input );
/* Make sure we won't try to remove it again */
*pp_input = NULL;
}
return 1;
}
static int vlclua_sd_remove_all_items_nodes( lua_State *L ) static int vlclua_sd_remove_all_items_nodes( lua_State *L )
{ {
services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L ); services_discovery_t *p_sd = (services_discovery_t *)vlclua_get_this( L );
...@@ -458,6 +473,7 @@ static const luaL_Reg vlclua_sd_reg[] = { ...@@ -458,6 +473,7 @@ static const luaL_Reg vlclua_sd_reg[] = {
{ "add_node", vlclua_sd_add_node }, { "add_node", vlclua_sd_add_node },
{ "add_item", vlclua_sd_add_item }, { "add_item", vlclua_sd_add_item },
{ "remove_item", vlclua_sd_remove_item }, { "remove_item", vlclua_sd_remove_item },
{ "remove_node", vlclua_sd_remove_node },
{ "remove_all_items_nodes", vlclua_sd_remove_all_items_nodes }, { "remove_all_items_nodes", vlclua_sd_remove_all_items_nodes },
{ NULL, NULL } { NULL, NULL }
}; };
......
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