Commit 2f49119c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

LUA: remove find_name() before something starts to use it

parent 26a440b8
......@@ -82,61 +82,12 @@ int vlclua_gc_release( lua_State *L )
return 0;
}
static int vlc_object_search_mode_from_string( const char *psz_name )
{
static const struct
{
int i_mode;
const char *psz_name;
} pp_modes[] =
{ { FIND_CHILD, "child" },
{ FIND_ANYWHERE, "anywhere" },
{ 0, "" } };
int i;
for( i = 0; pp_modes[i].i_mode; i++ )
{
if( !strcmp( psz_name, pp_modes[i].psz_name ) )
return pp_modes[i].i_mode;
}
return 0;
}
static int vlclua_object_find( lua_State *L )
{
lua_pushnil( L );
return 1;
}
static int vlclua_object_find_name( lua_State *L )
{
const char *psz_name = luaL_checkstring( L, 2 );
const char *psz_mode = luaL_checkstring( L, 3 );
vlc_object_t *p_this;
int i_mode = vlc_object_search_mode_from_string( psz_mode );
vlc_object_t *p_result;
if( !i_mode )
return luaL_error( L, "\"%s\" is not a valid search mode.",
psz_mode );
if( lua_type( L, 1 ) == LUA_TNIL )
p_this = vlclua_get_this( L );
else
{
vlc_object_t **p_obj = luaL_checkudata( L, 1, "vlc_object" );
p_this = *p_obj;
}
p_result = vlc_object_find_name( p_this, psz_name, i_mode );
if( !p_result )
lua_pushnil( L );
else
vlclua_push_vlc_object( L, p_result, vlclua_gc_release );
return 1;
}
static int vlclua_get_libvlc( lua_State *L )
{
vlclua_push_vlc_object( L, vlclua_get_this( L )->p_libvlc,
......@@ -175,7 +126,6 @@ static const luaL_Reg vlclua_object_reg[] = {
{ "playlist", vlclua_get_playlist },
{ "libvlc", vlclua_get_libvlc },
{ "find", vlclua_object_find },
{ "find_name", vlclua_object_find_name },
{ NULL, NULL }
};
......
......@@ -222,16 +222,7 @@ object.input(): Get the current input object.
object.playlist(): Get the playlist object.
object.libvlc(): Get the libvlc object.
object.find( object, type, mode ): Find an object of given type. mode can
be "child" and "anywhere". If set to "child" it will look in "object"'s
children. If set to "anywhere", it will look in all the objects. If
object is unset, the current module's object will be used.
Type can be: "libvlc", "playlist", "input", "decoder",
"vout", "aout", "packetizer", "generic".
This function is deprecated and slow and should be avoided.
object.find_name( object, name, mode ): Same as above except that it matches
on the object's name and not type. This function is also slow and should
be avoided if possible.
object.find( object, type, mode ): Return nil. DO NOT USE.
OSD
---
......
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