@@ -259,6 +259,8 @@ unsafe extern "C-unwind" {
259259 pub fn lua_call ( L : * mut lua_State , nargs : c_int , nresults : c_int ) ;
260260 pub fn lua_pcall ( L : * mut lua_State , nargs : c_int , nresults : c_int , errfunc : c_int ) -> c_int ;
261261 pub fn lua_cpcall ( L : * mut lua_State , f : lua_CFunction , ud : * mut c_void ) -> c_int ;
262+ pub fn lua_callyieldable ( L : * mut lua_State , nargs : c_int , nresults : c_int ) -> c_int ;
263+ pub fn lua_pcallyieldable ( L : * mut lua_State , nargs : c_int , nresults : c_int , errfunc : c_int ) -> c_int ;
262264
263265 //
264266 // Coroutine functions
@@ -293,9 +295,13 @@ pub const LUA_GCSTEP: c_int = 6;
293295pub const LUA_GCSETGOAL : c_int = 7 ;
294296pub const LUA_GCSETSTEPMUL : c_int = 8 ;
295297pub const LUA_GCSETSTEPSIZE : c_int = 9 ;
298+ pub const LUA_GCISPAUSED : c_int = 10 ;
299+
300+ pub type lua_CategoryName = unsafe extern "C" fn ( L : * mut lua_State , memcat : u8 ) -> * const c_char ;
296301
297302unsafe extern "C-unwind" {
298303 pub fn lua_gc ( L : * mut lua_State , what : c_int , data : c_int ) -> c_int ;
304+ pub fn lua_memorydump ( L : * mut lua_State , file : * mut c_void , category_name : Option < lua_CategoryName > ) ;
299305}
300306
301307//
@@ -304,6 +310,7 @@ unsafe extern "C-unwind" {
304310unsafe extern "C-unwind" {
305311 pub fn lua_setmemcat ( L : * mut lua_State , category : c_int ) ;
306312 pub fn lua_totalbytes ( L : * mut lua_State , category : c_int ) -> usize ;
313+ pub fn lua_allocationrate ( L : * mut lua_State ) -> i64 ;
307314}
308315
309316//
@@ -314,21 +321,33 @@ unsafe extern "C-unwind" {
314321 pub fn lua_next ( L : * mut lua_State , idx : c_int ) -> c_int ;
315322 pub fn lua_rawiter ( L : * mut lua_State , idx : c_int , iter : c_int ) -> c_int ;
316323 pub fn lua_concat ( L : * mut lua_State , n : c_int ) ;
324+ pub fn lua_setpointerencodekey ( L : * mut lua_State , a : u64 , b : u64 , c : u64 , d : u64 ) ;
317325 pub fn lua_encodepointer ( L : * mut lua_State , p : usize ) -> usize ;
318326 pub fn lua_clock ( ) -> c_double ;
319327 pub fn lua_setuserdatatag ( L : * mut lua_State , idx : c_int , tag : c_int ) ;
320328 pub fn lua_setuserdatadtor ( L : * mut lua_State , tag : c_int , dtor : Option < lua_Destructor > ) ;
321329 pub fn lua_getuserdatadtor ( L : * mut lua_State , tag : c_int ) -> Option < lua_Destructor > ;
330+ pub fn lua_setuserdatamark ( L : * mut lua_State , tag : c_int , markfn : Option < lua_UserdataMark > ) ;
331+ pub fn lua_setembeddergc ( L : * mut lua_State , gcfn : Option < lua_EmbedderGc > ) ;
332+ pub fn lua_weakref ( L : * mut lua_State , idx : c_int ) -> c_int ;
333+ pub fn lua_weakunref ( L : * mut lua_State , r#ref : c_int ) -> c_int ;
334+ pub fn lua_getweakref ( L : * mut lua_State , r#ref : c_int ) -> c_int ;
322335 pub fn lua_setuserdatametatable ( L : * mut lua_State , tag : c_int ) ;
323336 pub fn lua_getuserdatametatable ( L : * mut lua_State , tag : c_int ) ;
337+ pub fn lua_getuserdataname ( L : * mut lua_State , tag : c_int ) -> * const c_char ;
324338 pub fn lua_setlightuserdataname ( L : * mut lua_State , tag : c_int , name : * const c_char ) ;
325339 pub fn lua_getlightuserdataname ( L : * mut lua_State , tag : c_int ) -> * const c_char ;
326340 pub fn lua_clonefunction ( L : * mut lua_State , idx : c_int ) ;
341+ pub fn lua_usesexport ( L : * mut lua_State , idx : c_int ) -> c_int ;
327342 pub fn lua_cleartable ( L : * mut lua_State , idx : c_int ) ;
328343 pub fn lua_clonetable ( L : * mut lua_State , idx : c_int ) ;
329344 pub fn lua_getallocf ( L : * mut lua_State , ud : * mut * mut c_void ) -> lua_Alloc ;
330345}
331346
347+ pub type lua_UserdataMark = unsafe extern "C-unwind" fn ( L : * mut lua_State , ud : * mut c_void ) ;
348+ pub type lua_EmbedderMark = unsafe extern "C-unwind" fn ( L : * mut lua_State , r#ref : c_int ) ;
349+ pub type lua_EmbedderGc = unsafe extern "C-unwind" fn ( L : * mut lua_State , markref : Option < lua_EmbedderMark > ) ;
350+
332351//
333352// Reference system, can be used to pin objects
334353//
@@ -337,7 +356,7 @@ pub const LUA_REFNIL: c_int = 0;
337356
338357unsafe extern "C-unwind" {
339358 pub fn lua_ref ( L : * mut lua_State , idx : c_int ) -> c_int ;
340- pub fn lua_unref ( L : * mut lua_State , r#ref : c_int ) ;
359+ pub fn lua_unref ( L : * mut lua_State , r#ref : c_int ) -> c_int ;
341360}
342361
343362//
@@ -516,6 +535,7 @@ pub type lua_CounterValue =
516535 unsafe extern "C-unwind" fn ( context : * mut c_void , kind : c_int , line : c_int , hits : u64 ) ;
517536
518537unsafe extern "C-unwind" {
538+ pub fn lua_callhook ( L : * mut lua_State , hook : lua_Hook , userdata : * mut c_void ) ;
519539 pub fn lua_stackdepth ( L : * mut lua_State ) -> c_int ;
520540 pub fn lua_getinfo ( L : * mut lua_State , level : c_int , what : * const c_char , ar : * mut lua_Debug ) -> c_int ;
521541 pub fn lua_getargument ( L : * mut lua_State , level : c_int , n : c_int ) -> c_int ;
@@ -524,8 +544,12 @@ unsafe extern "C-unwind" {
524544 pub fn lua_getupvalue ( L : * mut lua_State , funcindex : c_int , n : c_int ) -> * const c_char ;
525545 pub fn lua_setupvalue ( L : * mut lua_State , funcindex : c_int , n : c_int ) -> * const c_char ;
526546
547+ pub fn lua_hascustomexecution ( L : * mut lua_State , level : c_int ) -> c_int ;
548+ pub fn lua_incustomexecution ( L : * mut lua_State , level : c_int ) -> c_int ;
549+
527550 pub fn lua_singlestep ( L : * mut lua_State , enabled : c_int ) ;
528551 pub fn lua_breakpoint ( L : * mut lua_State , funcindex : c_int , line : c_int , enabled : c_int ) -> c_int ;
552+ pub fn lua_atbreakpoint ( L : * mut lua_State ) -> c_int ;
529553
530554 pub fn lua_getcoverage ( L : * mut lua_State , funcindex : c_int , context : * mut c_void , callback : lua_Coverage ) ;
531555
@@ -548,6 +572,8 @@ pub struct lua_Debug {
548572 pub short_src : * const c_char ,
549573 pub linedefined : c_int ,
550574 pub currentline : c_int ,
575+ pub protoid : c_int ,
576+ pub bytecodeid : c_int ,
551577 pub nupvals : u8 ,
552578 pub nparams : u8 ,
553579 pub isvararg : c_char ,
@@ -585,8 +611,26 @@ pub struct lua_Callbacks {
585611 /// gets called when protected call results in an error
586612 pub debugprotectederror : Option < unsafe extern "C-unwind" fn ( L : * mut lua_State ) > ,
587613
588- /// gets called when memory is allocated
589- pub onallocate : Option < unsafe extern "C-unwind" fn ( L : * mut lua_State , osize : usize , nsize : usize ) > ,
614+ /// gets called after a heap object (or array) is allocated
615+ pub onallocate : Option <
616+ unsafe extern "C-unwind" fn (
617+ L : * mut lua_State ,
618+ block : * mut c_void ,
619+ osize : usize ,
620+ nsize : usize ,
621+ memcat : u8 ,
622+ tt : c_int ,
623+ tag : c_int ,
624+ ) ,
625+ > ,
626+
627+ /// gets called before `lua_resume` runs a coroutine
628+ pub preresume : Option < unsafe extern "C-unwind" fn ( L : * mut lua_State ) > ,
629+ /// gets called after `lua_resume` returns
630+ pub postresume : Option < unsafe extern "C-unwind" fn ( L : * mut lua_State ) > ,
631+
632+ /// gets called before a heap object (or array) is freed
633+ pub onfree : Option < unsafe extern "C-unwind" fn ( L : * mut lua_State , block : * mut c_void ) > ,
590634}
591635
592636unsafe extern "C" {
@@ -597,9 +641,4 @@ unsafe extern "C" {
597641unsafe extern "C" {
598642 pub fn luau_setfflag ( name : * const c_char , value : c_int ) -> c_int ;
599643 pub fn lua_getmetatablepointer ( L : * mut lua_State , idx : c_int ) -> * const c_void ;
600- pub fn lua_gcdump (
601- L : * mut lua_State ,
602- file : * mut c_void ,
603- category_name : Option < unsafe extern "C" fn ( L : * mut lua_State , memcat : u8 ) -> * const c_char > ,
604- ) ;
605644}
0 commit comments