Closing a file

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", " ")
file:write("bar")
file:close() -- THIS IS NEW! Don't forget to close!
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.42.128