src/p_net_ifc_lnx.c
static void
p_net_ifc_parseFlags( lua_State *L, struct ifaddrs *ifa )
{
	lua_pushstring( L, "flags" );
	lua_rawget( L, -2 );
	if (lua_isnil( L, -1 )) // only do it if it was'n done before
	{
		lua_pop( L, 1 );        // pop nil
		//if (ifa->ifa_addr && ifa->ifa_flags && ( AF_INET == ifa->ifa_addr->sa_family ||
		//	 AF_INET6 == ifa->ifa_addr->sa_family || AF_PACKET == ifa->ifa_addr->sa_family ))
		if (ifa->ifa_flags)
		{
			lua_createtable( L, 17, 0 );
#define IF_FLAG( FLG )                                   \
   lua_pushboolean( L, (ifa->ifa_flags & FLG) ? 1 : 0 ); \
   lua_setfield( L, -2, #FLG "" );

			IF_FLAG( IFF_UP );
			IF_FLAG( IFF_BROADCAST );
			IF_FLAG( IFF_DEBUG );
			IF_FLAG( IFF_LOOPBACK );
			IF_FLAG( IFF_POINTOPOINT );
			IF_FLAG( IFF_RUNNING );
			IF_FLAG( IFF_NOARP );
			IF_FLAG( IFF_PROMISC );
			IF_FLAG( IFF_NOTRAILERS );
			IF_FLAG( IFF_ALLMULTI );
			IF_FLAG( IFF_MASTER );
			IF_FLAG( IFF_SLAVE );
			IF_FLAG( IFF_MULTICAST );
			IF_FLAG( IFF_PORTSEL );
			IF_FLAG( IFF_AUTOMEDIA );
			IF_FLAG( IFF_DYNAMIC );
			lua_setfield( L, -2, "flags" );
#undef IF_FLAG
		}
	}
	else
		lua_pop(L, 1 );
}
/**--------------------------------------------------------------------------
 * Parse flags on interface.
 * \param   L        Lua state.
 * \param   flags    flags according to SIOCGIFFLAGS.
 * \lreturn table    Table representing with all flags.
 * --------------------------------------------------------------------------*/
Parse flags on interface.
\param   L        Lua state.
\param   flags    flags according to SIOCGIFFLAGS.
\lreturn table    Table representing with all flags.
Parse flags on interface . \ param L Lua state . \ param flags flags according to SIOCGIFFLAGS . \ lreturn table Table representing with all flags .
static void
p_net_ifc_parseFlags( lua_State *L, struct ifaddrs *ifa )
{
	lua_pushstring( L, "flags" );
	lua_rawget( L, -2 );
	if (lua_isnil( L, -1 )) 
	{
		lua_pop( L, 1 );        
		if (ifa->ifa_flags)
		{
			lua_createtable( L, 17, 0 );
#define IF_FLAG( FLG )                                   \
   lua_pushboolean( L, (ifa->ifa_flags & FLG) ? 1 : 0 ); \
   lua_setfield( L, -2, #FLG "" );
			IF_FLAG( IFF_UP );
			IF_FLAG( IFF_BROADCAST );
			IF_FLAG( IFF_DEBUG );
			IF_FLAG( IFF_LOOPBACK );
			IF_FLAG( IFF_POINTOPOINT );
			IF_FLAG( IFF_RUNNING );
			IF_FLAG( IFF_NOARP );
			IF_FLAG( IFF_PROMISC );
			IF_FLAG( IFF_NOTRAILERS );
			IF_FLAG( IFF_ALLMULTI );
			IF_FLAG( IFF_MASTER );
			IF_FLAG( IFF_SLAVE );
			IF_FLAG( IFF_MULTICAST );
			IF_FLAG( IFF_PORTSEL );
			IF_FLAG( IFF_AUTOMEDIA );
			IF_FLAG( IFF_DYNAMIC );
			lua_setfield( L, -2, "flags" );
#undef IF_FLAG
		}
	}
	else
		lua_pop(L, 1 );
}
static void p_net_ifc_parseFlags ( lua_State * L , struct ifaddrs * ifa ) { lua_pushstring ( L , " " ) ; lua_rawget ( L , -2 ) ; if ( lua_isnil ( L , -1 ) ) { lua_pop ( L , 1 ) ; if ( ifa -> ifa_flags ) { lua_createtable ( L , 17 , 0 ) ; #define IF_FLAG ( FLG )                                    \
   lua_pushboolean( L, (ifa->ifa_flags & FLG) ? 1 : 0 ); \
   lua_setfield( L, -2, #FLG "" ); IF_FLAG ( IFF_UP ) ; IF_FLAG ( IFF_BROADCAST ) ; IF_FLAG ( IFF_DEBUG ) ; IF_FLAG ( IFF_LOOPBACK ) ; IF_FLAG ( IFF_POINTOPOINT ) ; IF_FLAG ( IFF_RUNNING ) ; IF_FLAG ( IFF_NOARP ) ; IF_FLAG ( IFF_PROMISC ) ; IF_FLAG ( IFF_NOTRAILERS ) ; IF_FLAG ( IFF_ALLMULTI ) ; IF_FLAG ( IFF_MASTER ) ; IF_FLAG ( IFF_SLAVE ) ; IF_FLAG ( IFF_MULTICAST ) ; IF_FLAG ( IFF_PORTSEL ) ; IF_FLAG ( IFF_AUTOMEDIA ) ; IF_FLAG ( IFF_DYNAMIC ) ; lua_setfield ( L , -2 , " " ) ; #undef  IF_FLAG } } else lua_pop ( L , 1 ) ; }
Parse flags on interface.
Parse flags on interface .
// only do it if it was'n done before // pop nil //if (ifa->ifa_addr && ifa->ifa_flags && ( AF_INET == ifa->ifa_addr->sa_family || //	 AF_INET6 == ifa->ifa_addr->sa_family || AF_PACKET == ifa->ifa_addr->sa_family ))