[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: MAC Address
- From: Cuero Bugot <cbugot@...>
- Date: Tue, 15 Feb 2011 07:50:16 -0800
> For dumping the MAC Address, call os.execute ('ifconfig | grep HWaddr > [FILENAME]'). Then use io.open,
> read, close to get the > info from the file into a lua string, then os.remove (to delete the file) and
> strings functions find (search for 'HWaddr ') and sub to extract the MAC info
You could also use a more straight forward way (not using a temporary file):
local f = io.popen('ifconfig')
local t = f:read()
f:close()
local mac = t:match("HWaddr ([%:%x]*)")