1use std::ffi::CStr;
4use std::marker::{PhantomData, PhantomPinned};
5use std::os::raw::{c_char, c_double, c_float, c_int, c_uint, c_void};
6use std::{mem, ptr};
7
8pub const LUA_MULTRET: c_int = -1;
10
11const LUAI_MAXCSTACK: c_int = 1000000;
13
14pub const LUA_UTAG_LIMIT: c_int = 128;
16
17pub const LUA_LUTAG_LIMIT: c_int = 128;
19
20pub const LUA_REGISTRYINDEX: c_int = -LUAI_MAXCSTACK - 2000;
24pub const LUA_ENVIRONINDEX: c_int = -LUAI_MAXCSTACK - 2001;
25pub const LUA_GLOBALSINDEX: c_int = -LUAI_MAXCSTACK - 2002;
26
27pub const fn lua_upvalueindex(i: c_int) -> c_int {
28 LUA_GLOBALSINDEX - i
29}
30
31pub const LUA_OK: c_int = 0;
35pub const LUA_YIELD: c_int = 1;
36pub const LUA_ERRRUN: c_int = 2;
37pub const LUA_ERRSYNTAX: c_int = 3;
38pub const LUA_ERRMEM: c_int = 4;
39pub const LUA_ERRERR: c_int = 5;
40pub const LUA_BREAK: c_int = 6; pub const LUA_CORUN: c_int = 0; pub const LUA_COSUS: c_int = 1; pub const LUA_CONOR: c_int = 2; pub const LUA_COFIN: c_int = 3; pub const LUA_COERR: c_int = 4; #[repr(C)]
53pub struct lua_State {
54 _data: [u8; 0],
55 _marker: PhantomData<(*mut u8, PhantomPinned)>,
56}
57
58pub const LUA_TNONE: c_int = -1;
62
63pub const LUA_TNIL: c_int = 0;
64pub const LUA_TBOOLEAN: c_int = 1;
65
66pub const LUA_TLIGHTUSERDATA: c_int = 2;
67pub const LUA_TNUMBER: c_int = 3;
68pub const LUA_TVECTOR: c_int = 4;
69
70pub const LUA_TSTRING: c_int = 5;
71pub const LUA_TTABLE: c_int = 6;
72pub const LUA_TFUNCTION: c_int = 7;
73pub const LUA_TUSERDATA: c_int = 8;
74pub const LUA_TTHREAD: c_int = 9;
75pub const LUA_TBUFFER: c_int = 10;
76
77pub const LUA_MINSTACK: c_int = 20;
79
80pub type lua_Number = c_double;
82
83#[cfg(target_pointer_width = "32")]
85pub type lua_Integer = i32;
86#[cfg(target_pointer_width = "64")]
87pub type lua_Integer = i64;
88
89pub type lua_Unsigned = c_uint;
91
92pub type lua_CFunction = unsafe extern "C-unwind" fn(L: *mut lua_State) -> c_int;
94pub type lua_Continuation = unsafe extern "C-unwind" fn(L: *mut lua_State, status: c_int) -> c_int;
95
96pub type lua_Destructor = unsafe extern "C" fn(L: *mut lua_State, *mut c_void);
98
99pub type lua_Alloc =
101 unsafe extern "C" fn(ud: *mut c_void, ptr: *mut c_void, osize: usize, nsize: usize) -> *mut c_void;
102
103pub const fn luau_version() -> Option<&'static str> {
105 option_env!("LUAU_VERSION")
106}
107
108unsafe extern "C-unwind" {
109 pub fn lua_newstate(f: lua_Alloc, ud: *mut c_void) -> *mut lua_State;
113 pub fn lua_close(L: *mut lua_State);
114 pub fn lua_newthread(L: *mut lua_State) -> *mut lua_State;
115 pub fn lua_mainthread(L: *mut lua_State) -> *mut lua_State;
116 pub fn lua_resetthread(L: *mut lua_State);
117 pub fn lua_isthreadreset(L: *mut lua_State) -> c_int;
118
119 pub fn lua_absindex(L: *mut lua_State, idx: c_int) -> c_int;
123 pub fn lua_gettop(L: *mut lua_State) -> c_int;
124 pub fn lua_settop(L: *mut lua_State, idx: c_int);
125 pub fn lua_pushvalue(L: *mut lua_State, idx: c_int);
126 pub fn lua_remove(L: *mut lua_State, idx: c_int);
127 pub fn lua_insert(L: *mut lua_State, idx: c_int);
128 pub fn lua_replace(L: *mut lua_State, idx: c_int);
129 pub fn lua_checkstack(L: *mut lua_State, sz: c_int) -> c_int;
130 pub fn lua_rawcheckstack(L: *mut lua_State, sz: c_int);
131
132 pub fn lua_xmove(from: *mut lua_State, to: *mut lua_State, n: c_int);
133 pub fn lua_xpush(from: *mut lua_State, to: *mut lua_State, idx: c_int);
134
135 pub fn lua_isnumber(L: *mut lua_State, idx: c_int) -> c_int;
139 pub fn lua_isstring(L: *mut lua_State, idx: c_int) -> c_int;
140 pub fn lua_iscfunction(L: *mut lua_State, idx: c_int) -> c_int;
141 pub fn lua_isLfunction(L: *mut lua_State, idx: c_int) -> c_int;
142 pub fn lua_isuserdata(L: *mut lua_State, idx: c_int) -> c_int;
143 pub fn lua_type(L: *mut lua_State, idx: c_int) -> c_int;
144 pub fn lua_typename(L: *mut lua_State, tp: c_int) -> *const c_char;
145
146 pub fn lua_equal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int;
147 pub fn lua_rawequal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int;
148 pub fn lua_lessthan(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int;
149
150 pub fn lua_tonumberx(L: *mut lua_State, idx: c_int, isnum: *mut c_int) -> lua_Number;
151 #[link_name = "lua_tointegerx"]
152 pub fn lua_tointegerx_(L: *mut lua_State, idx: c_int, isnum: *mut c_int) -> c_int;
153 pub fn lua_tounsignedx(L: *mut lua_State, idx: c_int, isnum: *mut c_int) -> lua_Unsigned;
154 pub fn lua_tovector(L: *mut lua_State, idx: c_int) -> *const c_float;
155 pub fn lua_toboolean(L: *mut lua_State, idx: c_int) -> c_int;
156 pub fn lua_tolstring(L: *mut lua_State, idx: c_int, len: *mut usize) -> *const c_char;
157 pub fn lua_tostringatom(L: *mut lua_State, idx: c_int, atom: *mut c_int) -> *const c_char;
158 pub fn lua_tolstringatom(
159 L: *mut lua_State,
160 idx: c_int,
161 len: *mut usize,
162 atom: *mut c_int,
163 ) -> *const c_char;
164 pub fn lua_namecallatom(L: *mut lua_State, atom: *mut c_int) -> *const c_char;
165 #[link_name = "lua_objlen"]
166 pub fn lua_objlen_(L: *mut lua_State, idx: c_int) -> c_int;
167 pub fn lua_tocfunction(L: *mut lua_State, idx: c_int) -> Option<lua_CFunction>;
168 pub fn lua_tolightuserdata(L: *mut lua_State, idx: c_int) -> *mut c_void;
169 pub fn lua_tolightuserdatatagged(L: *mut lua_State, idx: c_int, tag: c_int) -> *mut c_void;
170 pub fn lua_touserdata(L: *mut lua_State, idx: c_int) -> *mut c_void;
171 pub fn lua_touserdatatagged(L: *mut lua_State, idx: c_int, tag: c_int) -> *mut c_void;
172 pub fn lua_userdatatag(L: *mut lua_State, idx: c_int) -> c_int;
173 pub fn lua_lightuserdatatag(L: *mut lua_State, idx: c_int) -> c_int;
174 pub fn lua_tothread(L: *mut lua_State, idx: c_int) -> *mut lua_State;
175 pub fn lua_tobuffer(L: *mut lua_State, idx: c_int, len: *mut usize) -> *mut c_void;
176 pub fn lua_topointer(L: *mut lua_State, idx: c_int) -> *const c_void;
177
178 pub fn lua_pushnil(L: *mut lua_State);
182 pub fn lua_pushnumber(L: *mut lua_State, n: lua_Number);
183 #[link_name = "lua_pushinteger"]
184 pub fn lua_pushinteger_(L: *mut lua_State, n: c_int);
185 pub fn lua_pushunsigned(L: *mut lua_State, n: lua_Unsigned);
186 #[cfg(not(feature = "luau-vector4"))]
187 pub fn lua_pushvector(L: *mut lua_State, x: c_float, y: c_float, z: c_float);
188 #[cfg(feature = "luau-vector4")]
189 pub fn lua_pushvector(L: *mut lua_State, x: c_float, y: c_float, z: c_float, w: c_float);
190 #[link_name = "lua_pushlstring"]
191 pub fn lua_pushlstring_(L: *mut lua_State, s: *const c_char, l: usize);
192 #[link_name = "lua_pushstring"]
193 pub fn lua_pushstring_(L: *mut lua_State, s: *const c_char);
194 #[link_name = "lua_pushfstringL"]
196 pub fn lua_pushfstring(L: *mut lua_State, fmt: *const c_char, ...) -> *const c_char;
197 pub fn lua_pushcclosurek(
198 L: *mut lua_State,
199 f: lua_CFunction,
200 debugname: *const c_char,
201 nup: c_int,
202 cont: Option<lua_Continuation>,
203 );
204 pub fn lua_pushboolean(L: *mut lua_State, b: c_int);
205 pub fn lua_pushthread(L: *mut lua_State) -> c_int;
206
207 pub fn lua_pushlightuserdatatagged(L: *mut lua_State, p: *mut c_void, tag: c_int);
208 pub fn lua_newuserdatatagged(L: *mut lua_State, sz: usize, tag: c_int) -> *mut c_void;
209 pub fn lua_newuserdatataggedwithmetatable(L: *mut lua_State, sz: usize, tag: c_int) -> *mut c_void;
210 pub fn lua_newuserdatadtor(L: *mut lua_State, sz: usize, dtor: lua_Destructor) -> *mut c_void;
211
212 pub fn lua_newbuffer(L: *mut lua_State, sz: usize) -> *mut c_void;
213
214 pub fn lua_gettable(L: *mut lua_State, idx: c_int) -> c_int;
218 pub fn lua_getfield(L: *mut lua_State, idx: c_int, k: *const c_char) -> c_int;
219 pub fn lua_rawgetfield(L: *mut lua_State, idx: c_int, k: *const c_char) -> c_int;
220 pub fn lua_rawget(L: *mut lua_State, idx: c_int) -> c_int;
221 #[link_name = "lua_rawgeti"]
222 pub fn lua_rawgeti_(L: *mut lua_State, idx: c_int, n: c_int) -> c_int;
223 pub fn lua_rawgetptagged(L: *mut lua_State, idx: c_int, p: *const c_void, tag: c_int) -> c_int;
224 pub fn lua_createtable(L: *mut lua_State, narr: c_int, nrec: c_int);
225
226 pub fn lua_setreadonly(L: *mut lua_State, idx: c_int, enabled: c_int);
227 pub fn lua_getreadonly(L: *mut lua_State, idx: c_int) -> c_int;
228 pub fn lua_setsafeenv(L: *mut lua_State, idx: c_int, enabled: c_int);
229
230 pub fn lua_getmetatable(L: *mut lua_State, objindex: c_int) -> c_int;
231 pub fn lua_getfenv(L: *mut lua_State, idx: c_int);
232
233 pub fn lua_settable(L: *mut lua_State, idx: c_int);
237 pub fn lua_setfield(L: *mut lua_State, idx: c_int, k: *const c_char);
238 pub fn lua_rawsetfield(L: *mut lua_State, idx: c_int, k: *const c_char);
239 pub fn lua_rawset(L: *mut lua_State, idx: c_int);
240 #[link_name = "lua_rawseti"]
241 pub fn lua_rawseti_(L: *mut lua_State, idx: c_int, n: c_int);
242 pub fn lua_rawsetptagged(L: *mut lua_State, idx: c_int, p: *const c_void, tag: c_int);
243 pub fn lua_setmetatable(L: *mut lua_State, objindex: c_int) -> c_int;
244 pub fn lua_setfenv(L: *mut lua_State, idx: c_int) -> c_int;
245
246 pub fn luau_load(
250 L: *mut lua_State,
251 chunkname: *const c_char,
252 data: *const c_char,
253 size: usize,
254 env: c_int,
255 ) -> c_int;
256 pub fn lua_call(L: *mut lua_State, nargs: c_int, nresults: c_int);
257 pub fn lua_pcall(L: *mut lua_State, nargs: c_int, nresults: c_int, errfunc: c_int) -> c_int;
258 pub fn lua_cpcall(L: *mut lua_State, f: lua_CFunction, ud: *mut c_void) -> c_int;
259
260 pub fn lua_yield(L: *mut lua_State, nresults: c_int) -> c_int;
264 pub fn lua_break(L: *mut lua_State) -> c_int;
265 #[link_name = "lua_resume"]
266 pub fn lua_resume_(L: *mut lua_State, from: *mut lua_State, narg: c_int) -> c_int;
267 pub fn lua_resumeerror(L: *mut lua_State, from: *mut lua_State) -> c_int;
268 pub fn lua_status(L: *mut lua_State) -> c_int;
269 pub fn lua_isyieldable(L: *mut lua_State) -> c_int;
270 pub fn lua_getthreaddata(L: *mut lua_State) -> *mut c_void;
271 pub fn lua_setthreaddata(L: *mut lua_State, data: *mut c_void);
272 pub fn lua_costatus(L: *mut lua_State, co: *mut lua_State) -> c_int;
273}
274
275#[inline(always)]
276pub unsafe fn lua_objlen(L: *mut lua_State, idx: c_int) -> usize {
277 lua_objlen_(L, idx) as usize
278}
279
280pub const LUA_GCSTOP: c_int = 0;
284pub const LUA_GCRESTART: c_int = 1;
285pub const LUA_GCCOLLECT: c_int = 2;
286pub const LUA_GCCOUNT: c_int = 3;
287pub const LUA_GCCOUNTB: c_int = 4;
288pub const LUA_GCISRUNNING: c_int = 5;
289pub const LUA_GCSTEP: c_int = 6;
290pub const LUA_GCSETGOAL: c_int = 7;
291pub const LUA_GCSETSTEPMUL: c_int = 8;
292pub const LUA_GCSETSTEPSIZE: c_int = 9;
293
294unsafe extern "C-unwind" {
295 pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int;
296}
297
298unsafe extern "C-unwind" {
302 pub fn lua_setmemcat(L: *mut lua_State, category: c_int);
303 pub fn lua_totalbytes(L: *mut lua_State, category: c_int) -> usize;
304}
305
306unsafe extern "C-unwind" {
310 pub fn lua_error(L: *mut lua_State) -> !;
311 pub fn lua_next(L: *mut lua_State, idx: c_int) -> c_int;
312 pub fn lua_rawiter(L: *mut lua_State, idx: c_int, iter: c_int) -> c_int;
313 pub fn lua_concat(L: *mut lua_State, n: c_int);
314 pub fn lua_encodepointer(L: *mut lua_State, p: usize) -> usize;
315 pub fn lua_clock() -> c_double;
316 pub fn lua_setuserdatatag(L: *mut lua_State, idx: c_int, tag: c_int);
317 pub fn lua_setuserdatadtor(L: *mut lua_State, tag: c_int, dtor: Option<lua_Destructor>);
318 pub fn lua_getuserdatadtor(L: *mut lua_State, tag: c_int) -> Option<lua_Destructor>;
319 pub fn lua_setuserdatametatable(L: *mut lua_State, tag: c_int);
320 pub fn lua_getuserdatametatable(L: *mut lua_State, tag: c_int);
321 pub fn lua_setlightuserdataname(L: *mut lua_State, tag: c_int, name: *const c_char);
322 pub fn lua_getlightuserdataname(L: *mut lua_State, tag: c_int) -> *const c_char;
323 pub fn lua_clonefunction(L: *mut lua_State, idx: c_int);
324 pub fn lua_cleartable(L: *mut lua_State, idx: c_int);
325 pub fn lua_clonetable(L: *mut lua_State, idx: c_int);
326 pub fn lua_getallocf(L: *mut lua_State, ud: *mut *mut c_void) -> lua_Alloc;
327}
328
329pub const LUA_NOREF: c_int = -1;
333pub const LUA_REFNIL: c_int = 0;
334
335unsafe extern "C-unwind" {
336 pub fn lua_ref(L: *mut lua_State, idx: c_int) -> c_int;
337 pub fn lua_unref(L: *mut lua_State, r#ref: c_int);
338}
339
340#[inline(always)]
345pub unsafe fn lua_tonumber(L: *mut lua_State, idx: c_int) -> lua_Number {
346 lua_tonumberx(L, idx, ptr::null_mut())
347}
348
349#[inline(always)]
350pub unsafe fn lua_tointeger_(L: *mut lua_State, idx: c_int) -> c_int {
351 lua_tointegerx_(L, idx, ptr::null_mut())
352}
353
354#[inline(always)]
355pub unsafe fn lua_tounsigned(L: *mut lua_State, i: c_int) -> lua_Unsigned {
356 lua_tounsignedx(L, i, ptr::null_mut())
357}
358
359#[inline(always)]
360pub unsafe fn lua_pop(L: *mut lua_State, n: c_int) {
361 lua_settop(L, -n - 1)
362}
363
364#[inline(always)]
365pub unsafe fn lua_newtable(L: *mut lua_State) {
366 lua_createtable(L, 0, 0)
367}
368
369#[inline(always)]
370pub unsafe fn lua_newuserdata(L: *mut lua_State, sz: usize) -> *mut c_void {
371 lua_newuserdatatagged(L, sz, 0)
372}
373
374#[inline(always)]
375pub unsafe fn lua_newuserdata_t<T>(L: *mut lua_State, data: T) -> *mut T {
376 unsafe extern "C" fn destructor<T>(_: *mut lua_State, ud: *mut c_void) {
377 ptr::drop_in_place(ud as *mut T);
378 }
379
380 let ud_ptr = lua_newuserdatadtor(L, const { mem::size_of::<T>() }, destructor::<T>) as *mut T;
381 ptr::write(ud_ptr, data);
382 ud_ptr
383}
384
385#[inline(always)]
386pub unsafe fn lua_strlen(L: *mut lua_State, i: c_int) -> usize {
387 lua_objlen(L, i)
388}
389
390#[inline(always)]
391pub unsafe fn lua_isfunction(L: *mut lua_State, n: c_int) -> c_int {
392 (lua_type(L, n) == LUA_TFUNCTION) as c_int
393}
394
395#[inline(always)]
396pub unsafe fn lua_istable(L: *mut lua_State, n: c_int) -> c_int {
397 (lua_type(L, n) == LUA_TTABLE) as c_int
398}
399
400#[inline(always)]
401pub unsafe fn lua_islightuserdata(L: *mut lua_State, n: c_int) -> c_int {
402 (lua_type(L, n) == LUA_TLIGHTUSERDATA) as c_int
403}
404
405#[inline(always)]
406pub unsafe fn lua_isnil(L: *mut lua_State, n: c_int) -> c_int {
407 (lua_type(L, n) == LUA_TNIL) as c_int
408}
409
410#[inline(always)]
411pub unsafe fn lua_isboolean(L: *mut lua_State, n: c_int) -> c_int {
412 (lua_type(L, n) == LUA_TBOOLEAN) as c_int
413}
414
415#[inline(always)]
416pub unsafe fn lua_isvector(L: *mut lua_State, n: c_int) -> c_int {
417 (lua_type(L, n) == LUA_TVECTOR) as c_int
418}
419
420#[inline(always)]
421pub unsafe fn lua_isthread(L: *mut lua_State, n: c_int) -> c_int {
422 (lua_type(L, n) == LUA_TTHREAD) as c_int
423}
424
425#[inline(always)]
426pub unsafe fn lua_isbuffer(L: *mut lua_State, n: c_int) -> c_int {
427 (lua_type(L, n) == LUA_TBUFFER) as c_int
428}
429
430#[inline(always)]
431pub unsafe fn lua_isnone(L: *mut lua_State, n: c_int) -> c_int {
432 (lua_type(L, n) == LUA_TNONE) as c_int
433}
434
435#[inline(always)]
436pub unsafe fn lua_isnoneornil(L: *mut lua_State, n: c_int) -> c_int {
437 (lua_type(L, n) <= LUA_TNIL) as c_int
438}
439
440#[inline(always)]
441pub unsafe fn lua_pushliteral(L: *mut lua_State, s: &'static CStr) {
442 lua_pushstring_(L, s.as_ptr());
443}
444
445#[inline(always)]
446pub unsafe fn lua_pushcfunction(L: *mut lua_State, f: lua_CFunction) {
447 lua_pushcclosurek(L, f, ptr::null(), 0, None)
448}
449
450#[inline(always)]
451pub unsafe fn lua_pushcfunctiond(L: *mut lua_State, f: lua_CFunction, debugname: *const c_char) {
452 lua_pushcclosurek(L, f, debugname, 0, None)
453}
454
455#[inline(always)]
456pub unsafe fn lua_pushcclosure(L: *mut lua_State, f: lua_CFunction, nup: c_int) {
457 lua_pushcclosurek(L, f, ptr::null(), nup, None)
458}
459
460#[inline(always)]
461pub unsafe fn lua_pushcclosured(L: *mut lua_State, f: lua_CFunction, debugname: *const c_char, nup: c_int) {
462 lua_pushcclosurek(L, f, debugname, nup, None)
463}
464
465#[inline(always)]
466pub unsafe fn lua_pushlightuserdata(L: *mut lua_State, p: *mut c_void) {
467 lua_pushlightuserdatatagged(L, p, 0)
468}
469
470#[inline(always)]
471pub unsafe fn lua_setglobal(L: *mut lua_State, var: *const c_char) {
472 lua_setfield(L, LUA_GLOBALSINDEX, var)
473}
474
475#[inline(always)]
476pub unsafe fn lua_getglobal(L: *mut lua_State, var: *const c_char) -> c_int {
477 lua_getfield(L, LUA_GLOBALSINDEX, var)
478}
479
480#[inline(always)]
481pub unsafe fn lua_tostring(L: *mut lua_State, i: c_int) -> *const c_char {
482 lua_tolstring(L, i, ptr::null_mut())
483}
484
485const LUA_IDSIZE: usize = 256;
491
492pub type lua_Hook = unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug);
494
495pub type lua_Coverage = unsafe extern "C-unwind" fn(
496 context: *mut c_void,
497 function: *const c_char,
498 linedefined: c_int,
499 depth: c_int,
500 hits: *const c_int,
501 size: usize,
502);
503
504unsafe extern "C-unwind" {
505 pub fn lua_stackdepth(L: *mut lua_State) -> c_int;
506 pub fn lua_getinfo(L: *mut lua_State, level: c_int, what: *const c_char, ar: *mut lua_Debug) -> c_int;
507 pub fn lua_getargument(L: *mut lua_State, level: c_int, n: c_int) -> c_int;
508 pub fn lua_getlocal(L: *mut lua_State, level: c_int, n: c_int) -> *const c_char;
509 pub fn lua_setlocal(L: *mut lua_State, level: c_int, n: c_int) -> *const c_char;
510 pub fn lua_getupvalue(L: *mut lua_State, funcindex: c_int, n: c_int) -> *const c_char;
511 pub fn lua_setupvalue(L: *mut lua_State, funcindex: c_int, n: c_int) -> *const c_char;
512
513 pub fn lua_singlestep(L: *mut lua_State, enabled: c_int);
514 pub fn lua_breakpoint(L: *mut lua_State, funcindex: c_int, line: c_int, enabled: c_int) -> c_int;
515
516 pub fn lua_getcoverage(L: *mut lua_State, funcindex: c_int, context: *mut c_void, callback: lua_Coverage);
517
518 pub fn lua_debugtrace(L: *mut lua_State) -> *const c_char;
519}
520
521#[repr(C)]
522pub struct lua_Debug {
523 pub name: *const c_char,
524 pub what: *const c_char,
525 pub source: *const c_char,
526 pub short_src: *const c_char,
527 pub linedefined: c_int,
528 pub currentline: c_int,
529 pub nupvals: u8,
530 pub nparams: u8,
531 pub isvararg: c_char,
532 pub userdata: *mut c_void,
533 pub ssbuf: [c_char; LUA_IDSIZE],
534}
535
536#[repr(C)]
542#[non_exhaustive]
543pub struct lua_Callbacks {
544 pub userdata: *mut c_void,
546
547 pub interrupt: Option<unsafe extern "C-unwind" fn(L: *mut lua_State, gc: c_int)>,
549 pub panic: Option<unsafe extern "C-unwind" fn(L: *mut lua_State, errcode: c_int)>,
551
552 pub userthread: Option<unsafe extern "C-unwind" fn(LP: *mut lua_State, L: *mut lua_State)>,
554 pub useratom: Option<unsafe extern "C-unwind" fn(s: *const c_char, l: usize) -> i16>,
556
557 pub debugbreak: Option<unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug)>,
559 pub debugstep: Option<unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug)>,
561 pub debuginterrupt: Option<unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug)>,
563 pub debugprotectederror: Option<unsafe extern "C-unwind" fn(L: *mut lua_State)>,
565
566 pub onallocate: Option<unsafe extern "C-unwind" fn(L: *mut lua_State, osize: usize, nsize: usize)>,
568}
569
570unsafe extern "C" {
571 pub fn lua_callbacks(L: *mut lua_State) -> *mut lua_Callbacks;
572}
573
574unsafe extern "C" {
576 pub fn luau_setfflag(name: *const c_char, value: c_int) -> c_int;
577 pub fn lua_getmetatablepointer(L: *mut lua_State, idx: c_int) -> *const c_void;
578 pub fn lua_gcdump(
579 L: *mut lua_State,
580 file: *mut c_void,
581 category_name: Option<unsafe extern "C" fn(L: *mut lua_State, memcat: u8) -> *const c_char>,
582 );
583}