lua-users home
lua-l archive

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


Hello

Using a Lua script on XP, I need to open an HTML file and extract
hyperlinks...
===========
data = io.open("C:\places.txt","r") 
for line in data:lines() do 
      for token in string.gmatch(line, '<a
href="(/places/.+?\.php)">') do 
              print(token) 
      end 
end 
data:close()
===========

... but it fails with the following error message:
===========
lua5.1.exe: places.lua:2: attempt to index global 'data' (a nil value)
===========

Any idea what is wrong with the above?

Thank you.