How to write to the end of the file?

file:write() 

just replaces the text.

    1 answer 1

    According to the documentation , you need to open the file in add-on mode.

    An example from there:

     -- Opens a file in append mode file = io.open("test.lua", "a") -- appends a word test to the last line of the file file:write("--test") -- closes the open file file:close()