Lua binary files?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
infinte
Prole
Posts: 18
Joined: Wed Sep 21, 2011 9:31 am

Lua binary files?

Post by infinte »

Hi.
I'm thinking about a problem in destribution. Does love2d support lua "binery code"s generated by luac?
thanks.
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Lua binary files?

Post by ivan »

It probably does. Lua's virtual machine executes both compiled and non-compiled code alike.
Are you sure your luac.exe output is correct?
infinte
Prole
Posts: 18
Joined: Wed Sep 21, 2011 9:31 am

Re: Lua binary files?

Post by infinte »

ivan wrote:It probably does. Lua's virtual machine executes both compiled and non-compiled code alike.
Are you sure your luac.exe output is correct?
I've compiled a lua file (library-level, .lua) into binary (.b) and love cannot require it.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Lua binary files?

Post by miko »

infinte wrote:
ivan wrote:It probably does. Lua's virtual machine executes both compiled and non-compiled code alike.
Are you sure your luac.exe output is correct?
I've compiled a lua file (library-level, .lua) into binary (.b) and love cannot require it.
It needs the *.lua extension, unless you modify package.path. BTW, it will not work if the love was compiled with luajit (or: bytecode generated by lua and luajit are not interchangeable).
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
infinte
Prole
Posts: 18
Joined: Wed Sep 21, 2011 9:31 am

Re: Lua binary files?

Post by infinte »

miko wrote:
infinte wrote:
ivan wrote:It probably does. Lua's virtual machine executes both compiled and non-compiled code alike.
Are you sure your luac.exe output is correct?
I've compiled a lua file (library-level, .lua) into binary (.b) and love cannot require it.
It needs the *.lua extension, unless you modify package.path. BTW, it will not work if the love was compiled with luajit (or: bytecode generated by lua and luajit are not interchangeable).
Changing `package.path` works! thanks.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lua binary files?

Post by bartbes »

That is not a solution, since love ignores package.path, so when properly packaged it won't work. Instead, just name them with a lua extension. This, of course, raises the question why you would do such a thing in the first place.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Lua binary files?

Post by kikito »

infinte wrote:Hi.
I'm thinking about a problem in destribution. Does love2d support lua "binery code"s generated by luac?
thanks.
Using compiled lua bytecode doesn't help distribution - Pretty much the opposite; your .love file isn't guaranteed to work in all platforms.

Your problem probably has to do more with encryption than distribution. Luac alone will not help you on that regard; there's a standard decompiler, called luaDec51, which will easily undo the compiling.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests