11//! Contains definitions from `luacode.h`.
22
3+ use std:: marker:: { PhantomData , PhantomPinned } ;
34use std:: os:: raw:: { c_char, c_int, c_void} ;
45use std:: { ptr, slice} ;
56
@@ -15,6 +16,10 @@ pub struct lua_CompileOptions {
1516 pub vectorType : * const c_char ,
1617 pub mutableGlobals : * const * const c_char ,
1718 pub userdataTypes : * const * const c_char ,
19+ pub librariesWithKnownMembers : * const * const c_char ,
20+ pub libraryMemberTypeCallback : Option < lua_LibraryMemberTypeCallback > ,
21+ pub libraryMemberConstantCallback : Option < lua_LibraryMemberConstantCallback > ,
22+ pub disabledBuiltins : * const * const c_char ,
1823}
1924
2025impl Default for lua_CompileOptions {
@@ -29,10 +34,34 @@ impl Default for lua_CompileOptions {
2934 vectorType : ptr:: null ( ) ,
3035 mutableGlobals : ptr:: null ( ) ,
3136 userdataTypes : ptr:: null ( ) ,
37+ librariesWithKnownMembers : ptr:: null ( ) ,
38+ libraryMemberTypeCallback : None ,
39+ libraryMemberConstantCallback : None ,
40+ disabledBuiltins : ptr:: null ( ) ,
3241 }
3342 }
3443}
3544
45+ #[ repr( C ) ]
46+ pub struct lua_CompileConstant {
47+ _data : [ u8 ; 0 ] ,
48+ _marker : PhantomData < ( * mut u8 , PhantomPinned ) > ,
49+ }
50+
51+ pub type lua_LibraryMemberTypeCallback =
52+ extern "C" fn ( library : * const c_char , member : * const c_char ) -> c_int ;
53+
54+ pub type lua_LibraryMemberConstantCallback =
55+ extern "C" fn ( library : * const c_char , member : * const c_char , constant : * mut lua_CompileConstant ) ;
56+
57+ 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 ) ;
63+ }
64+
3665extern "C-unwind" {
3766 #[ link_name = "luau_compile" ]
3867 pub fn luau_compile_ (
0 commit comments