Skip to main content

luaur_bytecode/methods/
bytecode_builder_get_error.rs

1use crate::records::bytecode_builder::BytecodeBuilder;
2use alloc::string::String;
3
4impl BytecodeBuilder {
5    pub fn get_error(message: &str) -> String {
6        // 0 acts as a special marker for error bytecode (it's equal to LBC_VERSION_TARGET for valid bytecode blobs)
7        let mut result = String::with_capacity(message.len() + 1);
8        result.push('\0');
9        result.push_str(message);
10
11        result
12    }
13}