Also running LuaJIT with -jdump will dump bytecode and compiler IR I believe.
I read this guide ALOT when trying to understand how a VM worked, this guide was invaluable. It gave me enough knowledge to write my own VM. Recommended!
Let me guess, you were playing Hack 'n' Slash, and the control flow statements didn't make sense.