luaur-compiler 0.1.3

Luau source-to-bytecode compiler (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::enums::type_constant_folding::Type;
use crate::records::constant::Constant;
use core::ffi::c_char;

#[allow(non_snake_case)]
pub fn cstring_c_char_usize(v: *const c_char, len: usize) -> Constant {
    let mut res = Constant {
        r#type: Type::Type_String,
        string_length: len as u32,
        data: unsafe { core::mem::zeroed() },
    };

    unsafe {
        res.data.value_string = v;
    }

    res
}