Skip to content

Commit aa3f6ba

Browse files
committed
Fix prototype of new Luau compiler options and methods
1 parent cc57bed commit aa3f6ba

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

mlua-sys/src/luau/luacode.rs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,40 @@ pub struct lua_CompileConstant {
4848
_marker: PhantomData<(*mut u8, PhantomPinned)>,
4949
}
5050

51+
/// Type table tags
52+
#[doc(hidden)]
53+
#[repr(i32)]
54+
#[non_exhaustive]
55+
pub enum luau_BytecodeType {
56+
Nil = 0,
57+
Boolean,
58+
Number,
59+
String,
60+
Table,
61+
Function,
62+
Thread,
63+
UserData,
64+
Vector,
65+
Buffer,
66+
67+
Any = 15,
68+
}
69+
5170
pub type lua_LibraryMemberTypeCallback =
52-
extern "C" fn(library: *const c_char, member: *const c_char) -> c_int;
71+
unsafe extern "C-unwind" fn(library: *const c_char, member: *const c_char) -> c_int;
5372

54-
pub type lua_LibraryMemberConstantCallback =
55-
extern "C" fn(library: *const c_char, member: *const c_char, constant: *mut lua_CompileConstant);
73+
pub type lua_LibraryMemberConstantCallback = unsafe extern "C-unwind" fn(
74+
library: *const c_char,
75+
member: *const c_char,
76+
constant: *mut lua_CompileConstant,
77+
);
5678

5779
extern "C" {
58-
fn luau_set_compile_constant_nil(constant: *mut lua_CompileConstant);
59-
fn luau_set_compile_constant_boolean(constant: *mut lua_CompileConstant, b: c_int);
60-
fn luau_set_compile_constant_number(constant: *mut lua_CompileConstant, n: f64);
61-
fn luau_set_compile_constant_vector(constant: *mut lua_CompileConstant, x: f32, y: f32, z: f32, w: f32);
62-
fn luau_set_compile_constant_string(constant: *mut lua_CompileConstant, s: *const c_char, l: usize);
80+
pub fn luau_set_compile_constant_nil(cons: *mut lua_CompileConstant);
81+
pub fn luau_set_compile_constant_boolean(cons: *mut lua_CompileConstant, b: c_int);
82+
pub fn luau_set_compile_constant_number(cons: *mut lua_CompileConstant, n: f64);
83+
pub fn luau_set_compile_constant_vector(cons: *mut lua_CompileConstant, x: f32, y: f32, z: f32, w: f32);
84+
pub fn luau_set_compile_constant_string(cons: *mut lua_CompileConstant, s: *const c_char, l: usize);
6385
}
6486

6587
extern "C-unwind" {

0 commit comments

Comments
 (0)