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,56 @@ 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+ /// 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+
70+ pub type lua_LibraryMemberTypeCallback =
71+ unsafe extern "C-unwind" fn ( library : * const c_char , member : * const c_char ) -> c_int ;
72+
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+ ) ;
78+
79+ extern "C" {
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 ) ;
85+ }
86+
3687extern "C-unwind" {
3788 #[ link_name = "luau_compile" ]
3889 pub fn luau_compile_ (
0 commit comments