Love Byte

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
AlgidPlasma
Prole
Posts: 19
Joined: Mon Dec 19, 2011 11:17 pm

Love Byte

Post by AlgidPlasma » Sun Jul 08, 2012 2:42 am

Hey, got kind of bored an decided to create a Love2D bytecode compiler. Why you ask? well it allows your games to run faster and if you don't want anyone tinkering with your source the created .lua files are lua bytecode making them practically impossible to read. I dubbed this tiny (25 kb) program Love Byte and it is written in a few lines of c. It is currently only working on windows but I included the source file so any of you osx or linux users could probably port it pretty easily. It is command-line and is used like such: "LoveByte first.lua second.lua etc..." all the created bytecode files are put into a newly created folder called "compile" in the same directory as the program. The program is reliant on luac so you need to have it in the same directory (included in the zip). Anyway, tell me what you think.
Attachments
Love Byte.zip
(112.26 KiB) Downloaded 124 times

User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Love Byte

Post by Inny » Sun Jul 08, 2012 4:56 am

Don't use sprintf. It doesn't range-check the length of the buffer you supply it. Use snprintf instead.

Also, some side advice on the subject of code obfuscation, which I mentioned in the "Comment and Space Remover" thread:

For games that aren't commercially distributed, it encourages a lack of trust in the community. We were all newbies once, and still newbies on some facets of our experience. One of the ways we learned was through reading and understanding other's code. The community should remain friendly and when someone else learns from or uses your code, it should be considered flattery rather than theft. Our Libraries have such inviting names for a reason :P

User avatar
schme16
Party member
Posts: 127
Joined: Thu Oct 02, 2008 2:46 am

Re: Love Byte

Post by schme16 » Sun Jul 08, 2012 5:30 am

Inny wrote:Also, some side advice on the subject of code obfuscation, which I mentioned in the "Comment and Space Remover" thread:
For games that aren't commercially distributed, it encourages a lack of trust in the community. We were all newbies once, and still newbies on some facets of our experience. One of the ways we learned was through reading and understanding other's code. The community should remain friendly and when someone else learns from or uses your code, it should be considered flattery rather than theft. Our Libraries have such inviting names for a reason :P
Inny You do have a good point there: non-commercial or debugging code should be left in the open; if need be with a license that help protect your assets and ideas, or if compiled, a source file supplied or linked to.

I do however take a small exception to the fact that you've take the opportunity of using the first reply to AlgidPlasma to somewhat rain on his parade.
AlgidPlasma didn't say that everyone should start using it to hide their source, and even byte-code can be decompiled if need be; they merely stated the case for increased load speed and that code obfuscation was another effect.

All tools, positive or negative should be available, it's up to the programmers themselves to be responsible (especially seeing as this is not the only byte-code implementation available and certainly not the only way to obfuscate Lua code) with those tools.

AlgidPlasma: Good job on the Luac Bytecode Compiler, once you fix the sprintf problem it'll be great for a couple of projects I have that I'll be selling on a few online stores
My Development Diary - http://shanegadsby.info

User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Love Byte

Post by Inny » Sun Jul 08, 2012 10:41 pm

I do however take a small exception to the fact that you've take the opportunity of using the first reply to AlgidPlasma to somewhat rain on his parade.
Respectfully noted. The last thing I want to do is start a fight while trying to get everyone into a group hug.

AlgidPlasma
Prole
Posts: 19
Joined: Mon Dec 19, 2011 11:17 pm

Re: Love Byte

Post by AlgidPlasma » Mon Jul 09, 2012 1:51 pm

Updated version with snprintf() to prevent buffer overflows.
Attachments
LoveByte.zip
(158.44 KiB) Downloaded 139 times

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests