Skip to content

Commit

Permalink
refactor(compress) limit variable scope for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Feb 27, 2023
1 parent c322392 commit 7d77d1b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/pegasus/plugins/compress.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
local zlib = require "zlib"
local ZlibStream = {} do
local zlib = require "zlib"

local function zlib_name(lib)
if lib._VERSION and string.find(lib._VERSION, 'lua-zlib', nil, true) then
return 'lua-zlib'
end
local function zlib_name(lib)
if lib._VERSION and string.find(lib._VERSION, 'lua-zlib', nil, true) then
return 'lua-zlib'
end

if lib._VERSION and string.find(lib._VERSION, 'lzlib', nil, true) then
return 'lzlib'
if lib._VERSION and string.find(lib._VERSION, 'lzlib', nil, true) then
return 'lzlib'
end
end
end

local z_lib_name = assert(zlib_name(zlib), 'Unsupported zlib Lua binding')
local z_lib_name = assert(zlib_name(zlib), 'Unsupported zlib Lua binding')


local ZlibStream = {} do
ZlibStream.__index = ZlibStream

ZlibStream.NO_COMPRESSION = zlib.NO_COMPRESSION or 0
Expand Down Expand Up @@ -69,6 +70,8 @@ local ZlibStream = {} do
end
end



local Compress = {} do
Compress.__index = Compress

Expand Down

0 comments on commit 7d77d1b

Please sign in to comment.