lua-users home
lua-l archive

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

On Thu, Mar 18, 2010 at 2:38 PM, Luiz Henrique de Figueiredo
<> wrote:
> So, use io.popen instead.

f = io.popen('ipconfig /all')
line = f:read()
while line do
  if line:find 'Ethernet adapter Local Area Connection' then
    line = f:read()
    while not line:find 'Physical Address' do line = f:read() end
    print(line:match(': (.+)'))
  line = f:read()

The only semi-clever bit is the string match that returns everything
after the colon on the Physical Address line