Page 1 of 2

Lua encoding

Posted: Mon Oct 07, 2019 3:18 pm
by Coder567
Hi
i have been studying the topic of compiling lua and I have a couple of questions

1) What's the difference between luaJIT and luaC? Which one's better?

2) I'm using zero bane studio (windows) which has LOVE in it. Should there be also luaJIT somewhere?

3) Can the lua decompilers exes be downloaded from somewhere? I have only found couple (luajit-decomp, luadec) from here but didn't know how to use the luajit-decomp. And haven't got any luck trying to build one from sources

4) Is it possible to have part of your code compiled and rest not, so you can enable modding?

Edit: Another question

thanks!

Re: Lua encoding

Posted: Mon Oct 07, 2019 4:46 pm
by zorg
1. LuaC is the PuC version's compiler; LuaJIT is by Mike Pall. The former is only for compiling your lua scripts into bytecode that can be loaded in faster, but it won't get faster execution speeds. LuaJIT is a just-in-time compiler for lua, and what Löve uses by default; It also has facilities to pre-compile lua scripts into bytecode giving you the similar faster load speeds but again, not execution speeds. (LuaJIT is faster in most cases than PuC Lua though)

2. Löve already comes with LuaJIT by default.

3. Dunno, but don't expect the same quality from machine-decompiled content.

4. Yes, but mods can also be compiled of course... thing is, they would need to be compiled with the same lua version löve came with in your project you distributed for those to work that way.

Re: Lua encoding

Posted: Mon Oct 07, 2019 5:04 pm
by Coder567
zorg wrote:
Mon Oct 07, 2019 4:46 pm
2. Löve already comes with LuaJIT by default.
What does that mean in practice? That the script is run more efficiently? Or that it can be compiled by some command?

Re: Lua encoding

Posted: Mon Oct 07, 2019 5:31 pm
by zorg
The first definitely, compared to PuC lua, LuaJIT can run stuff way faster (I think i saw benchmarks for specific things that got executed almost as fast as C code); as for the other, not sure whether you can do it through löve or not, but of course, luaJIT also has a way to (pre-)compile files into bytecode... which, again, should be stated that the only reason you'd ever want to do that would be to speed up code loading times.

Re: Lua encoding

Posted: Mon Oct 07, 2019 7:03 pm
by raidho36
Everything can be decompiled so don't worry about it. If you're worried that someone will steal your great software invention - don't oversell yourself. It will at best be something that million other people already did and millions more will do without your input. There's nothing you can come up with that will be of any interest to other people.

Re: Lua encoding

Posted: Tue Oct 08, 2019 9:19 am
by Coder567
Thanks everyone for your replies!

raidho36 wrote:
Mon Oct 07, 2019 7:03 pm
It will at best be something that million other people already did and millions more will do without your input. There's nothing you can come up with that will be of any interest to other people.
Well that's encouraging :awesome:

I was hoping that even decoded, the source code would be obfuscated which would discourage anyone to make couple of changes and uploading it as he's own. It's not ideal protection but all I can do

Plus the license which everyone talks about

Re: Lua encoding

Posted: Tue Oct 08, 2019 9:27 am
by raidho36
Well that's literally what crackers and hackers do so you can't hope to stop people or even meaningfully impede them. And when someone wants to rip you off, they wouldn't even use any of your stuff, they'll just make a close enough copy. Again, don't worry about it.

Re: Lua encoding

Posted: Tue Oct 08, 2019 4:47 pm
by ingsoc451
Some game companies release their source code after a while. Some of them are big titles. But I don't remember any notable project using their source code.
So releasing the source code might be the best way to discourage people who are constantly trying to steal your code.

Re: Lua encoding

Posted: Wed Oct 09, 2019 11:41 am
by Coder567
My projects are always so big I would like to have some protection. Then after some time after the release I could release the code so people can mod it but at start I would like to have the source closed. Or partly open source, for modding.

I tried luajit to compile lua file but love couldn't read the compiled file

Re: Lua encoding

Posted: Wed Oct 09, 2019 11:51 am
by zorg
Coder567 wrote:
Wed Oct 09, 2019 11:41 am
My projects are always so big I would like to have some protection. Then after some time after the release I could release the code so people can mod it but at start I would like to have the source closed. Or partly open source, for modding.

I tried luajit to compile lua file but love couldn't read the compiled file
I think i mentioned it previously, but you need to use the same version of LuaJIT that the Löve version you have uses.