http://lua-users.org/wiki/IoLibraryTutorial
Reading input from the terminal
The following code will create a prompt at the terminal allowing the user to
type in anything they please and have it stored in the variable called name:
name = io.read()
Reading from a file
Line by line
lines = io.lines('file.txt')
for line in lines do print(line) end
All at once
file = io.open('file.txt')
contents = file:read("a") -- a means all, other options are n, l, and L.
file:close()
print(contents)