added type annotations and function documentation to liblz16 and pkgfs

This commit is contained in:
Izaya 2020-06-05 23:07:06 +10:00
parent 2ce2692aee
commit 97e559f26f
2 changed files with 3 additions and 3 deletions

View File

@ -54,14 +54,14 @@ local function writeBuffer(fo)
return buffer.new("wb",stream) return buffer.new("wb",stream)
end end
function lz16.buffer(stream) function lz16.buffer(stream) -- table -- table -- Wrap a stream to read or write LZ16.
if stream.mode.w then if stream.mode.w then
return writeBuffer(stream) return writeBuffer(stream)
end end
return readBuffer(stream) return readBuffer(stream)
end end
function lz16.open(fname, mode) function lz16.open(fname, mode) -- string string -- table -- Open file *fname* to read or write LZ16-compressed data depending on *mode*
local f = io.open(fname, mode) local f = io.open(fname, mode)
if not f then return false end if not f then return false end
f.mode.b = true f.mode.b = true

View File

@ -98,7 +98,7 @@ function pkgfs.component.close(handle)
return true return true
end end
function pkgfs.add(fname,comp) function pkgfs.add(fname,comp) -- string boolean -- -- Add a package as specified in *fname* to the pkgfs component. If *comp* is true, read it as a LZ16-compressed package.
if fname:sub(1,1) ~= "/" then if fname:sub(1,1) ~= "/" then
fname = "/"..fnormalize(os.getenv("PWD").."/"..fname) fname = "/"..fnormalize(os.getenv("PWD").."/"..fname)
end end