Skip to main content

luaur_bytecode/methods/
bytecode_builder_dump_everything.rs

1use crate::records::bytecode_builder::BytecodeBuilder;
2use crate::records::function::Function;
3use luaur_common::functions::format_append::formatAppend;
4
5impl BytecodeBuilder {
6    pub fn dump_everything(&self) -> String {
7        let mut result = String::new();
8
9        for (i, function) in self.functions.iter().enumerate() {
10            let debugname = if function.dumpname.is_empty() {
11                "??"
12            } else {
13                &function.dumpname
14            };
15
16            formatAppend(
17                &mut result,
18                format_args!("Function {} ({}):\n", i as i32, debugname),
19            );
20
21            result.push_str(&function.dump);
22            result.push('\n');
23        }
24
25        result
26    }
27}