1
1
//! Contains definitions from `luacode.h`.
2
2
3
+ use std:: marker:: { PhantomData , PhantomPinned } ;
3
4
use std:: os:: raw:: { c_char, c_int, c_void} ;
4
5
use std:: { ptr, slice} ;
5
6
@@ -15,6 +16,10 @@ pub struct lua_CompileOptions {
15
16
pub vectorType : * const c_char ,
16
17
pub mutableGlobals : * const * const c_char ,
17
18
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 ,
18
23
}
19
24
20
25
impl Default for lua_CompileOptions {
@@ -29,10 +34,34 @@ impl Default for lua_CompileOptions {
29
34
vectorType : ptr:: null ( ) ,
30
35
mutableGlobals : ptr:: null ( ) ,
31
36
userdataTypes : ptr:: null ( ) ,
37
+ librariesWithKnownMembers : ptr:: null ( ) ,
38
+ libraryMemberTypeCallback : None ,
39
+ libraryMemberConstantCallback : None ,
40
+ disabledBuiltins : ptr:: null ( ) ,
32
41
}
33
42
}
34
43
}
35
44
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
+
36
65
extern "C-unwind" {
37
66
#[ link_name = "luau_compile" ]
38
67
pub fn luau_compile_ (
0 commit comments