From what I can see of the love2d source, it appears that Love really wants the Lua source in source form, since it looks inside the .love file for specific files, such as "conf.lua" and "main.lua".
I'm curious if there is any thought towards pre-compiling the Lua code via luac and somehow packaging that into the .love file?
I doubt there would be any use to it besides some obfuscation of the game source (the compiled lua bytecode is often the same size, or larger, than the corresponding lua source, at least, if debugging symbols are left in place).
Pre-compiling files
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3132
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Pre-compiling files
You can precompile your Lua files using luac and rename them to .lua and it will work fine on your computer, however luac probably won't work between Lua versions and different architectures (x86 vs x64). If you use love with LuaJIT, its compiled files will work between different architectures I believe, but again not between different versions.
Re: Pre-compiling files
also, bytecode is... not safe
in terms of obfuscation it doesn't really help either since the bytecode format has been quite well documented and since you can get a disassembly from luac, if people really want your game's source then they could just as well reconstruct it based on that (or find a lua decompiler that doesnt choke on it)
afaik the only real benefit bytecode gives is improved loading time (which is probably going to be completely marginal unless your source files are huge), and that it means you can compile lua without the parser/compiler which is really only interesting if you need to reduce the size of the vm for embedded hardware
so there probably isnt much point in bytecode for general use
bytecode is probably somewhat more attractive for luajit since it has the ability to dump it in various formats which make it easier to embed into c source (and i believe its require is aware of this)
in terms of obfuscation it doesn't really help either since the bytecode format has been quite well documented and since you can get a disassembly from luac, if people really want your game's source then they could just as well reconstruct it based on that (or find a lua decompiler that doesnt choke on it)
afaik the only real benefit bytecode gives is improved loading time (which is probably going to be completely marginal unless your source files are huge), and that it means you can compile lua without the parser/compiler which is really only interesting if you need to reduce the size of the vm for embedded hardware
so there probably isnt much point in bytecode for general use
bytecode is probably somewhat more attractive for luajit since it has the ability to dump it in various formats which make it easier to embed into c source (and i believe its require is aware of this)
Re: Pre-compiling files
Search forum for "luac" ("Search" in the top right of the page)hlship wrote: I'm curious if there is any thought towards pre-compiling the Lua code via luac and somehow packaging that into the .love file?
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
Re: Pre-compiling files
Not very interested in this compiling/obfuscation theme but If you wan't install Lua / mess with luac and just for see the results you can try this online compiler. It return a precompiled lua file (Please spare me for the couldn't work because of bytecoding rant or that someone can rob your code in this way. Just being helpful).hlship wrote:From what I can see of the love2d source, it appears that Love really wants the Lua source in source form, since it looks inside the .love file for specific files, such as "conf.lua" and "main.lua".
I'm curious if there is any thought towards pre-compiling the Lua code via luac and somehow packaging that into the .love file?
I doubt there would be any use to it besides some obfuscation of the game source (the compiled lua bytecode is often the same size, or larger, than the corresponding lua source, at least, if debugging symbols are left in place).
http://mta.dzek.eu/compiler/
BTW what advantages have that LuaJIT you keep talking about? Have the same pre-compiling purpose of Luac or you will need to distribute LuaJIT along for realtime-processing?
Re: Pre-compiling files
I am by NO MEANS an expert, but it has something to do with the JIT part.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Pre-compiling files
Fun fact, at one time love had a distribution problem because it used luac versions of its internal scripts.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Pre-compiling files
When was this?bartbes wrote:Fun fact, at one time love had a distribution problem because it used luac versions of its internal scripts.
Help us help you: attach a .love.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Pre-compiling files
I don't quite remember, not too long ago, though.
Who is online
Users browsing this forum: Ahrefs [Bot] and 78 guests