luaur_bytecode/methods/
bytecode_builder_add_constant_boolean.rs1use crate::enums::r#type::Type;
2use crate::records::bytecode_builder::BytecodeBuilder;
3use crate::records::constant::Constant;
4use crate::records::constant::ConstantValue;
5use crate::records::constant_key::ConstantKey;
6
7impl BytecodeBuilder {
8 pub fn add_constant_boolean(&mut self, value: bool) -> i32 {
9 let c = Constant {
10 r#type: Type::Type_Boolean,
11 value: ConstantValue {
12 valueBoolean: value,
13 },
14 };
15
16 let k = ConstantKey {
17 r#type: Type::Type_Boolean,
18 value: value as u64,
19 extra: 0,
20 };
21
22 self.add_constant(k, c)
23 }
24}