lua-users home
lua-l archive

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


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.