Skip to main content

luaur_compiler/methods/
builtin_is_method.rs

1use crate::records::builtin::Builtin;
2
3impl Builtin {
4    pub fn is_method(&self, table: &str, name: &str) -> bool {
5        unsafe {
6            if self.object.value.is_null() || self.method.value.is_null() {
7                return false;
8            }
9            let obj_bytes = core::ffi::CStr::from_ptr(self.object.value).to_bytes();
10            let method_bytes = core::ffi::CStr::from_ptr(self.method.value).to_bytes();
11            obj_bytes == table.as_bytes() && method_bytes == name.as_bytes()
12        }
13    }
14}