Append support in LUA

xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
edited November 2012 in Technical Support
Appending files does not seem to work, now it may just be an error with how I have setup the code, but far as I can tell this should work:

code below is what ive tried, you can test it by putting it in a function and calling it twice, it should, in theory, create the file and then append it the second time.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->local ELogFile = io.open("config://test.txt", "a+")
if ELogFile then
    ELogFile:seek("end")
    ELogFile:write("Appending line" .. "\n")
    ELogFile:close()
else
    local ELogFile = io.open("config://test.txt", "w")
    if ELogFile then
        ELogFile:write("Initial line" .. "\n")
        ELogFile:close()
    end
end<!--c2--></div><!--ec2-->
Sign In or Register to comment.