#![allow(dead_code)]
mod puc_51;
mod puc_52;
mod puc_53;
mod puc_54;
mod puc_55;
use crate::runtime::function::Proto;
use crate::runtime::heap::{Gc, Heap};
pub(super) fn undump_puc(bytes: &[u8], heap: &mut Heap) -> Result<Gc<Proto>, String> {
if bytes.len() < 5 {
return Err("truncated PUC binary chunk".to_string());
}
match bytes[4] {
0x51 => puc_51::undump(bytes, heap),
0x52 => puc_52::undump(bytes, heap),
0x53 => puc_53::undump_puc_53(bytes, heap),
0x54 => puc_54::undump(bytes, heap),
0x55 => puc_55::undump_puc_55(bytes, heap),
v => Err(format!(
"unsupported PUC Lua version byte 0x{v:02x} (expected 0x51..0x55)"
)),
}
}