Zip:write([path])method
Writes a new entry in the Zip archive. The Zip archive should have been previously opened in "write" or "append" mode.
Parameters
[path]
An optional string representing the path and/or the name of the new entry in the Zip archive. If omitted, the new entry will be archived at the root of the Zip archive, using the name provided by the entry parameter.
Return value
Returns true if entry has been successfully added to the zip archive or false otherwise. You can check the Zip.error property to get the error message.Example
-- zip script
import compression
-- check if the file specified as argument exists
local f = sys.File(arg[1] or error("no file specified"))
if f.exists then
--- create a zip archive file with the same name
local archive = compression.Zip(f.name:gsub(f.extension, ".zip"), "write")
--- add the file to the archive
archive:write(f)
else
error(f.name.." not found")
end