Skip to main content

luaur_bytecode/methods/
bytecode_builder_table_shape_operator_eq.rs

1use crate::records::table_shape::TableShape;
2
3impl TableShape {
4    #[allow(non_snake_case)]
5    pub(crate) fn operator_eq(&self, other: &TableShape) -> bool {
6        // Note: FFlag::LuauCompileDuptableConstantPack2 is assumed true in modern Luau bytecode logic
7        // as the C++ source provides a branch for it.
8        if self.length != other.length {
9            return false;
10        }
11
12        let len = self.length as usize;
13        if self.keys[..len] != other.keys[..len] {
14            return false;
15        }
16
17        if self.hasConstants != other.hasConstants {
18            return false;
19        }
20
21        if self.hasConstants {
22            if self.constants[..len] != other.constants[..len] {
23                return false;
24            }
25        }
26
27        true
28    }
29}