I've added LuaJIT to my app and I'm trying to consider what that means besides a performance boost. Are there any tips on ways to use/abuse this? Can I hide the JIT scripts so users won't edit them? Will luac work with the JIT? Lastly, do I need to distribute DynASM?
Thanks in advance, Joe
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
joe rossi wrote:
> I've added LuaJIT to my app and I'm trying to consider what that
> means besides a performance boost. Are there any tips on ways to
> use/abuse this?
> Can I hide the JIT scripts so users won't edit them?
You mean jit.opt and so on? Well ... why bother? I mean it's open
source, so there's nothing secret about it. But if you are
worried that a user edits a script and then gets a crash: that's
their problem -- modifying the internals of any application is
a bad idea (unless you know what you are doing).
But if you have a really good reason (e.g. packaging everything
inside one executable): use luac -s and bin2c (from Lua 5.0) and
link them to your code. Load the bytecode (luaL_loadbuffer) at
startup and put the returned module function into package.preload.
Don't forget that your main program (e.g. what replaces lua.c)
needs to require the JIT modules _and_ run the start() function.
In pure Lua that would be: require("jit.opt").start().
> Will luac work with the JIT?
Yes. LuaJIT operates on internal structures (LClosure*, Proto*).
It doesn't even know whether the bytecode has been freshly
translated from source or whether it has been untangled from the
binary bytecode representation. It doesn't care about stripped
Be sure to use a luac that exactly matches the version LuaJIT is
based on. [Technically you can build luac with the LuaJIT source,
but it's a waste because the JIT engine is linked in, but stays
> Lastly, do I need to distribute DynASM?
No. You only need DynAsm during the build process of LuaJIT
itself. And only if you need to modify anything in the *.dasc or
*.dash files (very unlikely -- better file a bug report with me).
The only things you really need to distribute is the compiled C
code and the jit.opt* modules. An acknowledgment in the docs
would be nice though (but the license does not require it).
BTW: I plan on collecting a 'Who uses LuaJIT' list with links to
projects (hey, free advertising for you :-)). Anyone interested,
please mail me a short description and a link. Thank you!
[Don't worry, I'll guarantee your confidentiality if you have
mailed me non-publicly about LuaJIT in the past.]
BTW#2: I'm making progress on the next release. But I don't know
whether I can get it out before the end of the year.
Do you have a URL for that Luiz?
I have used Win32 resources for Lua code and found them to be
On 12/21/05, Luiz Henrique de Figueiredo <[hidden email]> wrote:
> > You can use luac as MP suggests; alternately (for windows only) you can
> > embed the lua source in a resource / dll.
> Why for Windows only? See my srlua for a solution that works everywhere.