File.eof read property
The File.eof property returns a boolean value indicating if the File position has reached the end of file or not. The file must have been opened before using the property.
local file = sys.File("unicode.txt") local msg = "" file:open() -- read the file char by char (slow ! do not use in real life !) while not file.eof do msg = msg..file:read(1) end print(msg)