Skip to main content

luaur_bytecode/methods/
bytecode_builder_add_import.rs

1use crate::enums::r#type::Type;
2use crate::records::bytecode_builder::BytecodeBuilder;
3use crate::records::constant::{Constant, ConstantValue};
4use crate::records::constant_key::ConstantKey;
5
6impl BytecodeBuilder {
7    pub fn add_import(&mut self, iid: u32) -> i32 {
8        let c = Constant {
9            r#type: Type::Type_Import,
10            value: ConstantValue { valueImport: iid },
11        };
12
13        let k = ConstantKey {
14            r#type: Type::Type_Import,
15            value: iid as u64,
16            extra: 0,
17        };
18
19        self.add_constant(k, c)
20    }
21}