i plan on comercially releasing games soon, so i would like to find out a way to compile to bytecode and then fuse it into an executable. I have been searching for a way for literal months, but i haven't found a way, let me tell you what happens when i do try to do a method.
So doing jit.version, i can see Love2D uses 2.1.0beta3, which is the version i use to do luajit -b test.lua test.bc. After i do do that i proceed to remove the contents of the .lua file, and add different code to it.
Let's show you what i originally had inside of test.lua (the code i compiled):
local test = {}
function test:load()
print("Worked.")
end
return test
So this is the code i compile, i then remove the contents of it and add this instead:
local f = assert(love.filesystem.load("test.bc"))
return f()
and then in my main.lua file i do this:
function love.load()
local testclass = require("test")
testclass:load()
end
When i do that, i produce this error (Before you ask, there's no syntax error in the Lua code before compilation.):
Error
test.lua:1: Syntax error: test.bc: cannot load incompatible bytecode
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'load'
test.lua:1: in main chunk
[C]: in function 'require'
main.lua:3: in function 'load'
[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
[C]: in function 'xpcall'
[C]: in function 'xpcall'
I genuinly have been looking for a way for literal months, if someone could help out, it'd be greatly appreciated!