Skip to main content
gamedev.net
🔒 Locked

Compiling Lua

Started by bigwaves Sep 27, 2008 at 7:26 AM 3 replies 3.3k views
Original Post
bigwaves
bigwaves
Hellow ! I have to compile the source code of Lua, so I install msysDTK to do it. After I install, i see the bin directorie but i don´t know what .exe i have to use ant i don´t know how to use. Can someone help me to compile Lua 5.1 ? Thanks !!!
gekko
gekko
Which OS and compiler are you using?
-- gekko
bigwaves
bigwaves
Windows XP e Dev C++
gekko
gekko
I've only used Visual Studio to compile the Windows build. Not sure if you don't know how to compile it, or compiled it and don't know what to do with it. When I build Lua, there's four main files I look for:

lua.exe
luac.exe
lua51.dll
lua51.lib

lua.exe is the interpreter. Simply put, you can start typing code in there and it will execute it as Lua code. This could be very useful to you if you're writing an entire program in Lua. I've only used Lua inside a C application, so I've actually never once touched it (my scripts are meaningless without access to glue functions).

luac.exe is the Lua compiler. Normally, if you were to load a file in Lua it would be compiled at that time. However, you can also compile it using this tool, and then load the compiled version. It's very nice if you don't want to ship your source code.

lua51.dll is needed to run Lua, in any form. If you simply try to load lua.exe, it will require this file. Also, if you load Lua into your program, you will need this library to run it.

lua51.lib is the static library used for implicitly linking to lua51.dll. So if you want to use Lua in your C program, you need to link to this file, and put lua51.dll in your executable's directory.

Hope that helps get your started.
-- gekko
Mike nl
Mike nl
Quote:
Original post by gekko
It's very nice if you don't want to ship your source code.

Well, theoretically, Lua is dead-easy to decompile. The compiler seriously does nothing fancy. No peephole optimizations, no register reusing, nothing. It's a literal one-by-one translation from statements to assembly. It'll store a value from a register into a global and then happily read it back into the same register at the very next instruction (I guess there may be side effects by that it has to assume).

So the only thing you hide by compiling is comments and local variable names (if the programmer doesn't forget the "local" keyword and strips debug info).

I've always meant to create a proper Lua decompiler, but it's a tricky process regardless of this.
Million-to-one chances occur nine times out of ten!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.