Expand description
Lunify
A crate for converting Lua bytecode to different versions and formats.
Currently Lua 5.0 and Lua 5.1 are supported inputs.
Example
use lunify::{Format, LunifyError, Endianness, BitWidth, unify};
// Lua bytecode in any suppored format
let input_bytes = include_bytes!("../test_files/lua50.luab");
// Desired output format. May specify pointer width, endianness, sizes of datatypes, ...
let output_format = Format {
endianness: Endianness::Little,
// Convert from bytecode that runs on a 32 bit machine to bytcode that runs on a 64 bit machine
size_t_width: BitWidth::Bit64,
..Format::default()
};
// Convert input bytes to the desired format
let output_bytes = unify(input_bytes, &output_format, &Default::default());
Modules
Structs
Lua bytecode format.
Memory layout of instructions inside the Lua bytecode (
SIZE_*
, POS_*
).Lua 5.0 and Lua 5.1 compile constants. The Lua interpreter is compiled with
certain predefined constants that affect how the bytecode is generated. This
structure represents a small subset of the constants that are relevant for
Lunify. If the bytecode you are trying to modify was complied with
non-standard constants, you can use these settings to make it compatible.
Enums
The width of Lua-internal types in bits.
The endianness of Lua-internal types.
Error during unify.
All possible operants of an instruction.
Functions
Takes Lua bytecode in a supported format and converts it to bytecode in the
specified output Format. Returns LunifyError on error.