https://github.com/ve5li/lunify
A crate for converting Lua bytecode to different versions and formats
https://github.com/ve5li/lunify
bytecode lua rust
Last synced: 9 months ago
JSON representation
A crate for converting Lua bytecode to different versions and formats
- Host: GitHub
- URL: https://github.com/ve5li/lunify
- Owner: vE5li
- License: mit
- Created: 2022-09-09T09:15:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-10T10:30:03.000Z (over 2 years ago)
- Last Synced: 2025-02-20T01:05:47.777Z (11 months ago)
- Topics: bytecode, lua, rust
- Language: Rust
- Homepage:
- Size: 177 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Lunify
[](https://github.com/ve5li/lunify/actions?query=workflow%3ATests)
[](https://github.com/ve5li/lunify/actions?query=workflow%3ACode+Quality)
[](https://github.com/ve5li/lunify/actions?query=workflow%3ATests)
[](https://opensource.org/licenses/MIT)
[](https://crates.io/crates/lunify)
A crate for converting Lua byte code to different versions and formats.
Currently Lua 5.0 and Lua 5.1 are supported inputs.
# Example
```rust
use lunify::{Format, LunifyError, Endianness, BitWidth, unify};
// Lua byte code 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 byte code that runs on a 32 bit machine to byte code 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());
```