lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

It's not portable, Mac doesn' have the proc interface.

On Thu, Mar 18, 2010 at 2:43 PM, Petr Štetiar <> wrote:

function mac(iface)
       if not iface then
               return nil, 'no interface'

       local f ='/proc/net/arp', 'r')
       if not f then
               return nil, 'open error'

       local match = string.format('%%x*:.*%s', iface)
       local mac = string.match(tostring(f:read('*a')), match)
       if mac then return mac:sub(1, 17), nil end