TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Mon Jan 01, 2018 4:27 pm Post subject: |
|
|
Try to see if there is an error.
Code: | -- Open file for reading
file, err = io.open(FILENAME,'r')
-- check for errors in opening file.
if file ~= nil and err then
print(err)
end
-- Catch nonexisting file
if file ~= nil then
-- Read file line by line, append it to aalist and close the filehandle
for line in file:lines() do
stringlist_add(aalist,line)
end
else
-- Create file if it didn't exist
file = io.open(FILENAME,'w')
file:close()
end |
_________________
|
|