Page 1 of 2

LöveZip, A zip compression library for LÖVE without any external libraries dependencies !

Posted: Tue Nov 07, 2017 12:30 pm
by RamiLego4Game
Hello everyone,

I have created a zip compression library for LÖVE without any external (DLL/SO) libraries dependencies making it so easy to use.

I used zip.lua from LuaRocks, and a CRC32.lua library.

Patched zip.lua to use love.math.compress instead of lzlib/lua-zlib.
And modified CRC32.lua to work under LuaJIT and use bitop.

Oh, and a note: the path protection has been removed, so please provide the paths with '/' instead of '\', without any double slashes, and without a slash at the start.

Another note: The library doesn't scan sub-directories, but you can do that manually.

You can find the documentation in LoveZip/init.lua.

Usage Example:

Code: Select all

local zip = require("LoveZip")

function love.load()
  zip.zip("/Result.zip", "test1.txt", "test2.txt", "test3", "test3/test4")
end

function love.draw()
  love.graphics.setColor(255,255,255,255)
  love.graphics.print("Done",50,50)
end
And here's the final work: https://github.com/RamiLego4Game/LoveZip

Enjoy, give feedback if possible.

Re: LöveZip, A zip compression library for LÖVE without any naive libraries dependencies !

Posted: Tue Nov 07, 2017 12:36 pm
by Nixola
So what you're saying is, we can use .love files to make .love files?

Re: LöveZip, A zip compression library for LÖVE without any naive libraries dependencies !

Posted: Tue Nov 07, 2017 12:56 pm
by RamiLego4Game
Nixola wrote: Tue Nov 07, 2017 12:36 pm So what you're saying is, we can use .love files to make .love files?
Yup, that was my main target when creating it, also for Windows we can easily append the data to the love.exe file, making it so easy to create love-release like using only love.

Re: LöveZip, A zip compression library for LÖVE without any naive libraries dependencies !

Posted: Tue Nov 07, 2017 2:13 pm
by ivan
Not bad, but I was really hoping for a pure Lua implementation of "zlib_compress".
And I think you mean "native" not "naive".
IMO, "love.math.compress" runs via compiled C/C++ code, namely "native code".
A more accurate topic description would be
"A zip compression library for LOVE without any EXTERNAL dependencies".
The library doesn't scan sub-directories, but you can do that manually
If you're going to depend on the Love2D functionality, you might as well support this using love.filesystem.

Re: LöveZip, A zip compression library for LÖVE without any naive libraries dependencies !

Posted: Tue Nov 07, 2017 2:22 pm
by RamiLego4Game
ivan wrote: Tue Nov 07, 2017 2:13 pm Not bad, but I was really hoping for a pure Lua implementation of "zlib_compress".
And I think you mean "native" not "naive".
IMO, "love.math.compress" runs via compiled C/C++ code, namely "native code".
A more accurate topic description would be
"A zip compression library for LOVE without any EXTERNAL dependencies".
The library doesn't scan sub-directories, but you can do that manually
If you're going to depend on the Love2D functionality, you might as well support this using love.filesystem.
Updated the topic name to say 'external libraries', thanks for this.
I patched zip.lua to use love.filesystem, but their code can only handle single directories, so I will modify it to support that.

Re: LöveZip, A zip compression library for LÖVE without any external libraries dependencies !

Posted: Tue Nov 07, 2017 3:51 pm
by yetneverdone
Wait, so it would be possible to make .exe file without needing the .dll and other files?

Re: LöveZip, A zip compression library for LÖVE without any external libraries dependencies !

Posted: Tue Nov 07, 2017 4:05 pm
by RamiLego4Game
yetneverdone wrote: Tue Nov 07, 2017 3:51 pm Wait, so it would be possible to make .exe file without needing the .dll and other files?
You always need the DLLs, but injecting a .love to love.exe is easy in Lua, so you can create a release system in löve.

Re: LöveZip, A zip compression library for LÖVE without any external libraries dependencies !

Posted: Sun Nov 12, 2017 11:31 pm
by dusoft
What's wrong with LOVE release? Lua code with few dependencies, but mature program:
https://github.com/MisterDA/love-release

Re: LöveZip, A zip compression library for LÖVE without any external libraries dependencies !

Posted: Mon Nov 13, 2017 3:52 am
by RamiLego4Game
dusoft wrote: Sun Nov 12, 2017 11:31 pm What's wrong with LOVE release? Lua code with few dependencies, but mature program:
https://github.com/MisterDA/love-release
Compiling the required ZIP library is the hardest thing ever on Windows.

Re: LöveZip, A zip compression library for LÖVE without any external libraries dependencies !

Posted: Mon Nov 13, 2017 9:05 pm
by Rucikir
RamiLego4Game wrote: Mon Nov 13, 2017 3:52 am
dusoft wrote: Sun Nov 12, 2017 11:31 pm What's wrong with LOVE release? Lua code with few dependencies, but mature program:
https://github.com/MisterDA/love-release
Compiling the required ZIP library is the hardest thing ever on Windows.
Yep, that's why I've never provided binaries ;)
This is a cool project ! I will definitely check how it could be used by love-release.