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

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
RamiLego4Game
Citizen
Posts: 73
Joined: Tue Jun 10, 2014 7:41 pm

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

Post by RamiLego4Game » Tue Nov 07, 2017 12:30 pm

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.
Last edited by RamiLego4Game on Tue Nov 07, 2017 2:19 pm, edited 4 times in total.
My works:

User avatar
Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

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

Post by Nixola » Tue Nov 07, 2017 12:36 pm

So what you're saying is, we can use .love files to make .love files?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

User avatar
RamiLego4Game
Citizen
Posts: 73
Joined: Tue Jun 10, 2014 7:41 pm

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

Post by RamiLego4Game » Tue Nov 07, 2017 12:56 pm

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.
My works:

User avatar
ivan
Party member
Posts: 1485
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post by ivan » 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.

User avatar
RamiLego4Game
Citizen
Posts: 73
Joined: Tue Jun 10, 2014 7:41 pm

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

Post by RamiLego4Game » Tue Nov 07, 2017 2:22 pm

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.
My works:

User avatar
yetneverdone
Party member
Posts: 349
Joined: Sat Sep 24, 2016 11:20 am
Contact:

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

Post by yetneverdone » Tue Nov 07, 2017 3:51 pm

Wait, so it would be possible to make .exe file without needing the .dll and other files?

User avatar
RamiLego4Game
Citizen
Posts: 73
Joined: Tue Jun 10, 2014 7:41 pm

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

Post by RamiLego4Game » Tue Nov 07, 2017 4:05 pm

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.
My works:

dusoft
Citizen
Posts: 95
Joined: Fri Nov 08, 2013 12:07 am

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

Post by dusoft » 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

User avatar
RamiLego4Game
Citizen
Posts: 73
Joined: Tue Jun 10, 2014 7:41 pm

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

Post by RamiLego4Game » 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.
My works:

User avatar
Rucikir
Party member
Posts: 128
Joined: Tue Nov 05, 2013 6:33 pm
Location: Paris
Contact:

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

Post by Rucikir » Mon Nov 13, 2017 9:05 pm

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.
Lua script to distribute your LÖVE games. love-release.lua : Forum | Github
@Rucikir

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest