@@ -16,7 +16,7 @@ use LuaRead;
16
16
use InsideCallback ;
17
17
use LuaTable ;
18
18
19
- extern fn destructor_wrapper ( lua : * mut ffi:: lua_State ) -> libc:: c_int {
19
+ extern "C" fn destructor_wrapper ( lua : * mut ffi:: lua_State ) -> libc:: c_int {
20
20
let impl_raw = unsafe { ffi:: lua_touserdata ( lua, ffi:: lua_upvalueindex ( 1 ) ) } ;
21
21
let imp: fn ( * mut ffi:: lua_State ) ->:: libc:: c_int = unsafe { mem:: transmute ( impl_raw) } ;
22
22
@@ -76,7 +76,7 @@ pub fn push_userdata<L, T, F>(data: T, mut lua: L, mut metatable: F) -> PushGuar
76
76
ffi:: lua_pushlightuserdata ( lua. as_mut_lua ( ) . 0 , mem:: transmute ( destructor_impl) ) ;
77
77
78
78
// pushing destructor_wrapper as a closure
79
- ffi:: lua_pushcclosure ( lua. as_mut_lua ( ) . 0 , mem :: transmute ( destructor_wrapper) , 1 ) ;
79
+ ffi:: lua_pushcclosure ( lua. as_mut_lua ( ) . 0 , destructor_wrapper, 1 ) ;
80
80
81
81
ffi:: lua_settable ( lua. as_mut_lua ( ) . 0 , -3 ) ;
82
82
}
@@ -94,12 +94,12 @@ pub fn push_userdata<L, T, F>(data: T, mut lua: L, mut metatable: F) -> PushGuar
94
94
PushGuard { lua : lua, size : 1 }
95
95
}
96
96
97
- ///
97
+ ///
98
98
pub fn read_userdata < ' t , ' c , T > ( mut lua : & ' c mut InsideCallback , index : i32 )
99
99
-> Result < & ' t mut T , & ' c mut InsideCallback >
100
100
where T : ' static + Any
101
101
{
102
- assert ! ( index == -1 ) ; // FIXME:
102
+ assert ! ( index == -1 ) ; // FIXME:
103
103
104
104
unsafe {
105
105
let expected_typeid = format ! ( "{:?}" , TypeId :: of:: <T >( ) ) ;
@@ -135,7 +135,7 @@ pub struct UserdataOnStack<T, L> {
135
135
136
136
impl < T , L > LuaRead < L > for UserdataOnStack < T , L > where L : AsMutLua + AsLua , T : ' static + Any {
137
137
fn lua_read_at_position ( mut lua : L , index : i32 ) -> Result < UserdataOnStack < T , L > , L > {
138
- assert ! ( index == -1 ) ; // FIXME:
138
+ assert ! ( index == -1 ) ; // FIXME:
139
139
140
140
unsafe {
141
141
let expected_typeid = format ! ( "{:?}" , TypeId :: of:: <T >( ) ) ;
@@ -172,7 +172,7 @@ impl<T, L> Deref for UserdataOnStack<T, L> where L: AsMutLua, T: 'static + Any {
172
172
type Target = T ;
173
173
174
174
fn deref ( & self ) -> & T {
175
- let me: & mut UserdataOnStack < T , L > = unsafe { mem:: transmute ( self ) } ; // FIXME:
175
+ let me: & mut UserdataOnStack < T , L > = unsafe { mem:: transmute ( self ) } ; // FIXME:
176
176
let data = unsafe { ffi:: lua_touserdata ( me. variable . as_mut_lua ( ) . 0 , -1 ) } ;
177
177
let data: & T = unsafe { mem:: transmute ( data) } ;
178
178
data
0 commit comments