Script Luar [ Simple → ]
-- Append string to file function file_utils.append_file(filename, content) local f, err = io.open(filename, "a") if not f then return false, err end f:write(content) f:close() return true end
file_utils.write_file("test.txt", "Lua rocks!") print(file_utils.read_file("test.txt")) script luar
-- Read entire file as string (returns nil + error on failure) function file_utils.read_file(filename) local f, err = io.open(filename, "r") if not f then return nil, err end local content = f:read("*all") f:close() return content end -- Append string to file function file_utils


