[Windows Mobile Software Development] Co0kieMonster:
Intro:

This is an all-in-one tool for decompiling, compiling and comparing lua scripts found in Manila (TouchFLO 3D / Sense).

All this is a continuation of sztupy's original work: Lua 5.1 tools.

General:

LuaTool consists of 4 parts: Lua decompiler, Lua compiler, Lua compare utility and a Manila file type detection utility.

LuaDec 3.2 - Lua decompiler

Notes on latest version:

Major overhaul of the local finding algorithm. Most lua scripts can now be fully decompiled without a problem.

Manila 2.5.1921 has a total of 703 scripts (including embedded scripts). LuaDec can fully decompile 663 files. That's a success rate of 94.31%.

General notes:

LuaDec automatically checks if the output file was decompiled successfully.

If it wasn't, LuaDec will also output the disassembly and compare file.

In case the decompile was 100% good, LuaDec will only output the standard .lua file as before.

LuaC 1.2 - Lua compiler

Binary function replacement:

LuaC can directly replace functions in compiled luac files. This can be useful if the luac file can't be fully decompiled, but only a small part of the file needs to be edited. Some more info on function replacement.

Continue statement:

The "continue" statement has been added to the Lua Compiler.

Lua doesn't officially support continue statements, but it looks like HTC added it for their needs, so I'm following their lead.

Usage and versions:

LuaTool 1.2 by Co0kieMonster
Usage: LuaTool <task_select> [task_options] <task_input>
Tasks:
/decompile (or /d) -- Lua Decompiler
/compile (or /c) -- Lua Compiler
/compare (or /cr) -- Lua Compare utility
/detect (or /dt) -- Manila file type detect utility

LuaDec 3.2
Usage: LuaTool /decompile [options] <inputfile>
Available Options:
-o <filename> specify output file name
-dis don't decompile, just disassemble
-f <number> decompile/disassemble only function number (0 = global block)

LuaC 1.2
Usage: LuaTool /compile [options] <inputfile>
Available Options:
-o <filename> specify output file name
-s strip debug information
-r <n> <luac_file> replace function <n> in <luac_file> with <inputfile>

LuaCompare 1.2.1
Usage: LuaTool /compare [options] <original.luac> <newfile.lua(c)>
Available Options:
-o <filename> specify output file name
-s side by side file comparison
-du disable underline

ManilaDetect
Usage: LuaTool /detect <inputfile>

LuaTool changelog:

# LuaTool v1.2

-updated LuaDec to v3.2, LuaC to v1.2 and LuaCompare to v1.2.1

# LuaTool v1.1

-updated LuaDec to v3.1, LuaC to v1.1 and LuaCompare to v1.2

LuaDec changelog:

# LuaDec v3.2

-Local guesser improvements

---major overhaul - gives much better results

-Conditionals handling improvements

---fixed elseif not being recognised in some cases

---added partial support for complex inline boolean assingment

-General improvements

---fixed single function decompile

---fixed table assignments where there are more then 16 values

---better error handling

# LuaDec v3.1

-Conditionals handling improvements

---wrote a brand new algorithm for handling complex logic expressions

---fixed falsely detected generic for loops

---fixed misplaced if end, because of end-to-break optimization

-Local guesser improvements

---declarations at CALL before RETURN

-General improvements

---fixed indents not behaving properly in some cases

---fixed LOADNIL assignments where the destinations are local variables

---decompiler now displays success rate after decompile

---added SETLIST handling

# LuaDec v3.0.4

-General improvements:

---added back error messages

---fixed variable arguments handling

---fixed multiple inline assignments

---fixed a rare if ending misplacement

-Local guesser improvements at:

---inline bool assignments

---table in table situations

---TAILCALLs

---CALLs which return multiple results

---locals declared just before TEST ops

---SETTABLE where b isn't a constant

# LuaDec v3.0

-core rewrite and cleanup

-more accurate especially with conditionals and loops

-some miscellaneous accuracy improvements

-added extra info to script header (date, time, file name and manila name)

-LuaCompare updated to v1.0.1 (compatibility)

# LuaDec v2.1

- Less crashing:

--- added a failsafe for crashing on bad registers

--- fixed crash on SETUPVAL

--- fixed crash on SETLIST

- Better conditional handling:

--- fixed handling of deeper nested else and elseif

--- fixed handling of empty if-end and else-end blocks

--- added break handling

- Better table handling:

--- fixed inline table assignments

--- fixed handling of numerically indexed tables

- Adjustments to local guesser:

--- fixed guessing for inline table assignments

--- fixed guessing for SETGLOBAL and SETUPVAL at PC 1

LuaC changelog:

# LuaC v1.2

-added binary function replacement

# LuaC v1.1

-added "continue" statement

LuaCompare changelog:

# LuaCompare v1.2.1

-small change to support single function decompile

# LuaCompare v1.2

-pre-compare disassembly is now done internally instead of writing to disk and reading

-added a console message with match percentage

# LuaCompare v1.1

-initial version integrated in LuaTool