4
4
5
5
use std:: ptr;
6
6
use std:: mem;
7
- use std:: os:: raw:: { c_char, c_double, c_int, c_longlong, c_void} ;
7
+ use std:: os:: raw:: { c_char, c_double, c_int, c_longlong, c_uchar , c_void} ;
8
8
9
9
pub type lua_Integer = c_longlong ;
10
10
pub type lua_Number = c_double ;
@@ -18,6 +18,24 @@ pub type lua_KFunction =
18
18
unsafe extern "C" fn ( state : * mut lua_State , status : c_int , ctx : lua_KContext ) -> c_int ;
19
19
pub type lua_CFunction = unsafe extern "C" fn ( state : * mut lua_State ) -> c_int ;
20
20
21
+ #[ repr( C ) ]
22
+ pub struct lua_Debug {
23
+ pub event : c_int ,
24
+ pub name : * const c_char ,
25
+ pub namewhat : * const c_char ,
26
+ pub what : * const c_char ,
27
+ pub source : * const c_char ,
28
+ pub currentline : c_int ,
29
+ pub linedefined : c_int ,
30
+ pub lastlinedefined : c_int ,
31
+ pub nups : c_uchar ,
32
+ pub nparams : c_uchar ,
33
+ pub isvararg : c_char ,
34
+ pub istailcall : c_char ,
35
+ pub short_src : [ c_char ; LUA_IDSIZE as usize ] ,
36
+ i_ci : * mut c_void ,
37
+ }
38
+
21
39
pub const LUA_OK : c_int = 0 ;
22
40
pub const LUA_YIELD : c_int = 1 ;
23
41
pub const LUA_ERRRUN : c_int = 2 ;
@@ -34,6 +52,7 @@ pub const LUAI_MAXSTACK: c_int = 1_000_000;
34
52
pub const LUA_REGISTRYINDEX : c_int = -LUAI_MAXSTACK - 1000 ;
35
53
pub const LUA_RIDX_MAINTHREAD : lua_Integer = 1 ;
36
54
pub const LUA_RIDX_GLOBALS : lua_Integer = 2 ;
55
+ pub const LUA_IDSIZE : c_int = 60 ;
37
56
// Not actually defined in lua.h / luaconf.h
38
57
pub const LUA_MAX_UPVALUES : c_int = 255 ;
39
58
@@ -141,6 +160,7 @@ extern "C" {
141
160
pub fn lua_error ( state : * mut lua_State ) -> !;
142
161
pub fn lua_atpanic ( state : * mut lua_State , panic : lua_CFunction ) -> lua_CFunction ;
143
162
pub fn lua_gc ( state : * mut lua_State , what : c_int , data : c_int ) -> c_int ;
163
+ pub fn lua_getinfo ( state : * mut lua_State , what : * const c_char , ar : * mut lua_Debug ) -> c_int ;
144
164
145
165
pub fn luaopen_base ( state : * mut lua_State ) -> c_int ;
146
166
pub fn luaopen_coroutine ( state : * mut lua_State ) -> c_int ;
0 commit comments