Read & Write a File
These are general functions that can be used to read or write any type of string data to or from a permanent text file. These make use of Lua's Io Library functions, which can be hard to understand without a template.
Alternatively, instead of getting the entire file as a single string, you may instead want to break it down into its individual lines.
function WriteFile(FilePath, Contents)
To merge a table of "lines" into a single string with each value on a separate line, use
String = table.concat(Table, '\n')