Read text file and iterate through items?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Read text file and iterate through items?
- From: Gilles Ganault <gilles.ganault@...>
- Date: 2011年4月18日 18:55:41 +0200
Hello
I'd like to read a text file into either a string or a a table,
provided I can iterate through the items it contains.
Both ways end with error "unexpected symbol near 'for'":
==============
libs = io.open("dynlibs.txt","r")
libs = libs:read("*all")
-- unexpected symbol near 'for'
for lib in libs do
print(lib)
end
libs:close()
==============
libs = io.open("dynlibs.txt","r")
local tlibs = {}
tlibs=libs:read("*all")
-- unexpected symbol near 'for'
for lib in tlibs do
print(lib)
end
==============
How do this in Lua?
Thank you.