July 2018
Beginner
202 pages
5h 42m
English
Once you are done working with a file, close the file. Not closing the file is considered a resource leak, which can lead to issues until you restart your computer. Closing a file is simple, just call the close member function on the file handle. For example:
local file = io.open("data.txt", "w")file:write("foo", "\n")file:write("bar")file:close() -- THIS IS NEW! Don't forget to close!