Content Redacted. Please Delete Thread.

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Centauri Soldier
Prole
Posts: 42
Joined: Mon May 21, 2012 6:38 am

Content Redacted. Please Delete Thread.

Post by Centauri Soldier »

Content Redacted.
Last edited by Centauri Soldier on Mon Aug 22, 2016 2:32 am, edited 10 times in total.
User avatar
Centauri Soldier
Prole
Posts: 42
Joined: Mon May 21, 2012 6:38 am

Re: SQLite3 for Lua - A Simple Database System

Post by Centauri Soldier »

Updated to automatically write the appropriate dll/so file to the calling directory when the program is archived (.love) or compiled (.exe).
User avatar
Centauri Soldier
Prole
Posts: 42
Joined: Mon May 21, 2012 6:38 am

Re: SQLite3 for Lua - A Simple Database System

Post by Centauri Soldier »

Removed the need for the library files and removed the files themselves.
The source directory is no longer required, SQLite3 now needs only the path to a writeable directory.

SQLite3 is configured to work for LOVE right out of the box: just require("myplugins.sqlite3") and go!
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: SQLite3 for Lua - A Simple Database System

Post by Positive07 »

Saving a dll in a Lua string? Mmm sorry but I dislike the idea entirely, what's the problem with shipping dlls and so files as files? You wouldn't need to base64 encode nor decode it, you wouldn't have to load all those string into memory, you could load chunks as you copy them and discard them once they are not needed. Really I wouldn't use this, I prefere to make a zip file with the dll itself and make each user download the package for their system. Even then I don't see SQLite3 as being super useful for games being such a big dependecy anf databases not being commonly used for most games
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Centauri Soldier
Prole
Posts: 42
Joined: Mon May 21, 2012 6:38 am

Re: SQLite3 for Lua - A Simple Database System

Post by Centauri Soldier »

Thanks for the feedback, Positive07. I see your point about the extra memory. Although I would venture to say that using less than 2mb of memory is trivial; however, due to the fact that such consumption seems to be a concern (and out of acknowledgement of good programming practices :P), I will nullify the data after loading to prevent retention of unnecessary data.

Thanks for the tip :D.
Last edited by Centauri Soldier on Sun Aug 21, 2016 11:18 pm, edited 4 times in total.
User avatar
Centauri Soldier
Prole
Posts: 42
Joined: Mon May 21, 2012 6:38 am

Re: SQLite3 for Lua - A Simple Database System

Post by Centauri Soldier »

All Library data is now removed after library file as been written to prevent unnecessary data retention in memory.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: SQLite3 for Lua - A Simple Database System

Post by Positive07 »

Don't double post, you can edit your posts, also it doesn't really solve the issue, 2MB of memory consumed by a string is not something I would want in my program, as I said there are better ways to ship a binary library, installers and zip packages are really common you know? Also this means that I would be shipping a dll and so files to each platforms instead of the specific library I need for that specific platform, I don't need so files in Windows and I don't need dllls in Linux or Mac OSX, also encoding in base64 means that each byte is stored in a byte and a half, taking 50% more space in the package... Really I don't think this method is nice, I prefere the raw dlls and so files
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Centauri Soldier
Prole
Posts: 42
Joined: Mon May 21, 2012 6:38 am

Re: SQLite3 for Lua - A Simple Database System

Post by Centauri Soldier »

Positive07 wrote:Don't double post, you can edit your posts...
I didn't double post. The update having its own post was intentional. A double-post is when there are two separate posts with identical content.
Positive07 wrote:...also it doesn't really solve the issue, 2MB of memory consumed by a string is not something I would want in my program...
It really does solve the problem since the 2MB memory consumption occurs for about 1 second only.
Positive07 wrote:I don't need so files in Windows and I don't need dllls in Linux or Mac OSX, also encoding in base64 means that each byte is stored in a byte and a half, taking 50% more space in the package...
Thirty years ago, you would have had a valid point but at this stage, with modern storage being what it is, you're just splitting hairs: 2MB for a file is negligible. The original libraries are listed in the first post if all you want is one, specific library file.

As stated in the title, this is a "simple" system, designed to be simple for the user. It is setup using only one line of code and works across multiple platforms. That means no copying files manually from one place to the next or trying to figure out how to include file A or file B in their project for cross-platform support. This is a plug-and-play system designed specifically for simplicity and compatibility, not for hoarding HDD space to the maximum possible extent. If you can't find the 2MB on your HDD to spare, then this is not the plugin for you.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: SQLite3 for Lua - A Simple Database System

Post by slime »

A few tips:
  • [wiki]love.filesystem.newFileData[/wiki] can decode a base64-encoded string for you.
  • You can use [wiki]love.system.getOS[/wiki] to determine the operating system at runtime, instead of using io.popen.
  • If LuaJIT is being used (LOVE uses it by default, so it's safe to rely on it), you can use jit.arch to determine the current architecture (x86, x64, arm, arm64).
  • You can use [wiki]love.filesystem.write[/wiki] to write a string/bytes or a Data object directly to a file in the game's save directory, instead of using io.open. I highly recommend using love.filesystem functionality in place of the io library. You can also use [wiki]love.filesystem.exists[/wiki].
  • LOVE doesn't (and will not in future versions) provide 32 bit Mac downloads, so you can drop support for that. All Macs that run macOS 10.7 - love's current minimum required macOS version - will have a 64 bit operating system and will run a 64 bit version of LOVE.
Last edited by slime on Mon Aug 22, 2016 1:10 am, edited 1 time in total.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: SQLite3 for Lua - A Simple Database System

Post by Positive07 »

If you say "I'm gonna fix this issue like this" and then post "I fixed the issue like this", that looks like the same thing to me so it's double posting

Your library has almost the same size as LÖVE zip package for Windows, so it is way too much, for most little projects.

Packaging a dll or a so file in two different packages is trivial, that would be needed anyway since you can't just distribute .love files to end users
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 48 guests