Page 1 of 1

Love Byte

Posted: Sun Jul 08, 2012 2:42 am
by AlgidPlasma
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.

Re: Love Byte

Posted: Sun Jul 08, 2012 4:56 am
by Inny
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

Re: Love Byte

Posted: Sun Jul 08, 2012 5:30 am
by schme16
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

Re: Love Byte

Posted: Sun Jul 08, 2012 10:41 pm
by Inny
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.

Re: Love Byte

Posted: Mon Jul 09, 2012 1:51 pm
by AlgidPlasma
Updated version with snprintf() to prevent buffer overflows.