Page 1 of 2

luac question

Posted: Sat Aug 21, 2010 7:30 pm
by slushe
After compiling a lua script with luac--what does the file need to be named so that love can read it?

Re: luac question

Posted: Sat Aug 21, 2010 7:49 pm
by bartbes
Nothing different, if it's your main.lua, name it main.lua. I have to say, I can't advice you to use luac.

Re: luac question

Posted: Sun Aug 22, 2010 2:51 am
by slushe
I see. Figured it might be a way to protect source.

Re: luac question

Posted: Sun Aug 22, 2010 9:01 am
by thelinx
Will only work on the OS and architecture you compiled it on. So if you compiled it in 32-bit Windows, it wouldn't work on Linux, OS X, and not even 64-bit Windows.

Re: luac question

Posted: Tue Aug 24, 2010 5:21 am
by Jasoco
I guess hypothetically you could compile a version on every OS then release each one as a finished launchable product separately for each platform.

Re: luac question

Posted: Tue Aug 24, 2010 5:48 am
by bartbes
It should be somewhat compatible around platforms, just not versions, well lua bytecode is kind of a grey area, I don't think anyone knows exactly where it does and does not run.

Re: luac question

Posted: Wed Aug 25, 2010 7:16 pm
by Robin
Bytecode for "source code protection" is right up there with black cats and those little crosses.

Re: luac question

Posted: Thu Aug 26, 2010 9:10 am
by pekka
The luac manual page says this.
The binary files created by luac are portable only among architectures
with the same word size and byte order.

Re: luac question

Posted: Fri Aug 27, 2010 2:16 am
by Felipe Budinich
Robin wrote:Bytecode for "source code protection" is right up there with black cats and those little crosses.
Be careful or you could get sued for religious intolerance, some people really believe that Santa is real.

But in all seriousness it could deter my mother from looking at the source code.

Re: luac question

Posted: Sun Sep 19, 2010 4:14 pm
by Sergeant
thelinx wrote:Will only work on the OS and architecture you compiled it on. So if you compiled it in 32-bit Windows, it wouldn't work on Linux, OS X, and not even 64-bit Windows.
Only partially correct.
The binary files created by luac are portable to all architectures with the same word size. This means that binary files created on a 32-bit platform (such as Intel) can be read without change in another 32-bit platform (such as Sparc), even if the byte order (``endianess'') is different. On the other hand, binary files created on a 16-bit platform cannot be read in a 32-bit platform.
This was taken from the 4.0 Lua manual, but the same holds true for 5.1.