lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Is there an easy way to dump a list of the instructions (opcodes+args) from a loaded chunk (a Proto object on stack), bypassing all sanity checks etc.? Just the "code" field of the "Proto" class, in some readable format.
I'm fiddling with Lua internals, and after parsing some code I got a LUA_TPROTO, failing precheck() at condition: "GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN". I'd like to get some picture as to what I've actually got here in the "code" field, compared with the same code compiled using regular luac.
(Note: failed precheck() means I can't use string.dump()/lua_dump()).

Thanks in advance
/Mateusz Czapliński.