Help with using files

Hey facepunch users, I’ve struggled to figure out how to edit files after creation.

[lua]if not file.IsDir(‘example’, ‘DATA’) then
file.CreateDir(‘example’, ‘DATA’)
end

local date = os.date("%m_%d_%y")

if not file.Exists(‘example/’ … date … ‘.txt’, ‘DATA’) then
file.Write(‘example/’ … date … ‘.txt’, os.date("%H:%M") … " - Creation
" )
end
[/lua]

This will create a file
“garrysmod/data/example/date.txt”
containing a message saying
hours:minutes - Creation

How do I add to this file later on?

[lua]file.Append(‘example/’ … date … ‘.txt’, os.date("%H:%M") … " - Addition")[/lua]
is not seeming to work for me. The script stops responding.



] lua_run file.Append('sweg.txt', os.date("%H:%M") .. " - Addition")
> file.Append('sweg.txt', os.date("%H:%M") .. " - Addition")...
] lua_run file.Append('sweg.txt', os.date("%H:%M") .. " - Addition")
> file.Append('sweg.txt', os.date("%H:%M") .. " - Addition")...


works fine here.