writing to Lua files

How do I write to the end of a file?

file:write()

Just replaces the text.

 1
lua
Author: P.L, 2016-11-29

1 answers

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

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()
 3
Author: VladD, 2016-11-29 17:49:12