Skip to content

Commit

Permalink
Update Luau to 0.657
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed Jan 27, 2025
1 parent b5d38ab commit cc57bed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mlua-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cfg-if = "1.0"
pkg-config = "0.3.17"
lua-src = { version = ">= 547.0.0, < 547.1.0", optional = true }
luajit-src = { version = ">= 210.5.0, < 210.6.0", optional = true }
luau0-src = { version = "0.11.1", optional = true }
luau0-src = { version = "0.12.0", optional = true }

[lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(raw_dylib)'] }
29 changes: 29 additions & 0 deletions mlua-sys/src/luau/luacode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Contains definitions from `luacode.h`.
use std::marker::{PhantomData, PhantomPinned};
use std::os::raw::{c_char, c_int, c_void};
use std::{ptr, slice};

Expand All @@ -15,6 +16,10 @@ pub struct lua_CompileOptions {
pub vectorType: *const c_char,
pub mutableGlobals: *const *const c_char,
pub userdataTypes: *const *const c_char,
pub librariesWithKnownMembers: *const *const c_char,
pub libraryMemberTypeCallback: Option<lua_LibraryMemberTypeCallback>,
pub libraryMemberConstantCallback: Option<lua_LibraryMemberConstantCallback>,
pub disabledBuiltins: *const *const c_char,
}

impl Default for lua_CompileOptions {
Expand All @@ -29,10 +34,34 @@ impl Default for lua_CompileOptions {
vectorType: ptr::null(),
mutableGlobals: ptr::null(),
userdataTypes: ptr::null(),
librariesWithKnownMembers: ptr::null(),
libraryMemberTypeCallback: None,
libraryMemberConstantCallback: None,
disabledBuiltins: ptr::null(),
}
}
}

#[repr(C)]
pub struct lua_CompileConstant {
_data: [u8; 0],
_marker: PhantomData<(*mut u8, PhantomPinned)>,
}

pub type lua_LibraryMemberTypeCallback =
extern "C" fn(library: *const c_char, member: *const c_char) -> c_int;

pub type lua_LibraryMemberConstantCallback =
extern "C" fn(library: *const c_char, member: *const c_char, constant: *mut lua_CompileConstant);

extern "C" {
fn luau_set_compile_constant_nil(constant: *mut lua_CompileConstant);
fn luau_set_compile_constant_boolean(constant: *mut lua_CompileConstant, b: c_int);
fn luau_set_compile_constant_number(constant: *mut lua_CompileConstant, n: f64);
fn luau_set_compile_constant_vector(constant: *mut lua_CompileConstant, x: f32, y: f32, z: f32, w: f32);
fn luau_set_compile_constant_string(constant: *mut lua_CompileConstant, s: *const c_char, l: usize);
}

extern "C-unwind" {
#[link_name = "luau_compile"]
pub fn luau_compile_(
Expand Down

0 comments on commit cc57bed

Please sign in to comment.