lua-users home
lua-l archive

Re: Extracting list of items from line?

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


On 18/04/2011 12:19, Gilles Ganault wrote:
Also, I'm confused about when to use : and ., eg. should I use
execs:read() or execs.read()?
execs is an object (i.e. userdata), thus execs:read()
Try the following:
for line in io.lines("execs.txt") do
 local libs = line:match(" (.*)")
 if not libs then error("Space not found in " .. line) end
 for lib in libs:gmatch("[^,]+") do print(lib) end
 print("----")
end
--
Shmuel

AltStyle によって変換されたページ (->オリジナル) /