Commit 11ffab8a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

lua: separate generic and interface-specific net functions

parent 26989ea2
......@@ -821,7 +821,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
luaopen_dialog( L, p_ext );
luaopen_input( L );
luaopen_msg( L );
luaopen_net( L );
luaopen_net_generic( L );
luaopen_object( L );
luaopen_osd( L );
luaopen_playlist( L );
......
......@@ -255,7 +255,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
luaopen_input( L );
luaopen_msg( L );
luaopen_misc( L );
luaopen_net( L );
luaopen_net_intf( L );
luaopen_object( L );
luaopen_osd( L );
luaopen_playlist( L );
......
......@@ -30,7 +30,8 @@ void luaopen_httpd( lua_State * );
void luaopen_input( lua_State * );
void luaopen_msg( lua_State * );
void luaopen_misc( lua_State * );
void luaopen_net( lua_State * );
void luaopen_net_generic( lua_State * );
void luaopen_net_intf( lua_State * );
void luaopen_object( lua_State * );
void luaopen_osd( lua_State * );
void luaopen_playlist( lua_State * );
......
......@@ -491,8 +491,7 @@ static int vlclua_opendir( lua_State *L )
/*****************************************************************************
*
*****************************************************************************/
static const luaL_Reg vlclua_net_reg[] = {
{ "url_parse", vlclua_url_parse },
static const luaL_Reg vlclua_net_intf_reg[] = {
{ "listen_tcp", vlclua_net_listen_tcp },
{ "connect_tcp", vlclua_net_connect_tcp },
{ "close", vlclua_net_close },
......@@ -503,15 +502,18 @@ static const luaL_Reg vlclua_net_reg[] = {
{ "read", vlclua_fd_read },
{ "write", vlclua_fd_write },
#endif
/* The following functions do not depend on intf_thread_t and do not really
* belong in net.* but are left here for backward compatibility: */
{ "url_parse", vlclua_url_parse },
{ "stat", vlclua_stat }, /* Not really "net" */
{ "opendir", vlclua_opendir }, /* Not really "net" */
{ NULL, NULL }
};
void luaopen_net( lua_State *L )
void luaopen_net_intf( lua_State *L )
{
lua_newtable( L );
luaL_register( L, NULL, vlclua_net_reg );
luaL_register( L, NULL, vlclua_net_intf_reg );
#define ADD_CONSTANT( name, value ) \
lua_pushinteger( L, value ); \
lua_setfield( L, -2, name );
......@@ -523,3 +525,17 @@ void luaopen_net( lua_State *L )
ADD_CONSTANT( "POLLNVAL", POLLNVAL )
lua_setfield( L, -2, "net" );
}
static const luaL_Reg vlclua_net_generic_reg[] = {
{ "url_parse", vlclua_url_parse },
{ "stat", vlclua_stat }, /* Not really "net" */
{ "opendir", vlclua_opendir }, /* Not really "net" */
{ NULL, NULL }
};
void luaopen_net_generic( lua_State *L )
{
lua_newtable( L );
luaL_register( L, NULL, vlclua_net_generic_reg );
lua_setfield( L, -2, "net" );
}
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