Bladeren bron

Removed redundant function.
Added .lib for x86 windows

IVogel 2 jaren geleden
bovenliggende
commit
ec3ec8f8db
2 gewijzigde bestanden met toevoegingen van 28 en 35 verwijderingen
  1. BIN
      lib/i686/windows/lua_shared.lib
  2. 28 35
      src/lib.rs

BIN
lib/i686/windows/lua_shared.lib


+ 28 - 35
src/lib.rs

@@ -447,7 +447,34 @@ extern "C" {
     pub fn Lerror(state: lua_State, fmt: *const u8, ...) -> i32;
 }
 
-unsafe fn create_callback<FUNC>(state: lua_State, callback: FUNC)
+/// Pushes rust function/closure to lua stack.
+/// # Example
+/// ```
+/// let state = newstate();
+/// createtable(state, 0, 2);
+/// pushfunction(state, |_| {
+///     println!("Hello there!");
+///     Ok(0)
+/// });
+/// setfield(state, -2, cstr!("test_immutable_closure"));
+/// fn test_function(state: lua_State) -> Result {
+///     println!("Hello there, but from functuin, I guess.");
+///     Ok(0)
+/// }
+/// pushfunction(state, test_function);
+/// setfield(state, -2, cstr!("test_immutable_function"));
+/// 
+/// let mut counter = 0;
+/// pushfunction_mut(state, move |_| {
+///     println!("Here is yout counter!: {}", counter);
+///     pushinteger(state, counter);
+///     counter += 1;
+///     Ok(1)
+/// });
+/// setfield(state, -2, cstr!("test_mutable_closure"));
+/// setfield(state, GLOBALSINDEX, cstr!("tests"));
+/// ```
+pub unsafe fn pushfunction<FUNC>(state: lua_State, callback: FUNC)
 where
     FUNC: 'static + FnMut(lua_State) -> Result,
 {
@@ -487,37 +514,3 @@ where
     setmetatable(state, -2);
     pushcclosure(state, call_callback::<FUNC>, 1);
 }
-
-/// Pushes rust function/closure to lua stack.
-/// # Example
-/// ```
-/// let state = newstate();
-/// createtable(state, 0, 2);
-/// pushfunction(state, |_| {
-///     println!("Hello there!");
-///     Ok(0)
-/// });
-/// setfield(state, -2, cstr!("test_immutable_closure"));
-/// fn test_function(state: lua_State) -> Result {
-///     println!("Hello there, but from functuin, I guess.");
-///     Ok(0)
-/// }
-/// pushfunction(state, test_function);
-/// setfield(state, -2, cstr!("test_immutable_function"));
-/// 
-/// let mut counter = 0;
-/// pushfunction_mut(state, move |_| {
-///     println!("Here is yout counter!: {}", counter);
-///     pushinteger(state, counter);
-///     counter += 1;
-///     Ok(1)
-/// });
-/// setfield(state, -2, cstr!("test_mutable_closure"));
-/// setfield(state, GLOBALSINDEX, cstr!("tests"));
-/// ```
-pub unsafe fn pushfunction<FUNC>(state: lua_State, func: FUNC)
-where
-    FUNC: 'static + FnMut(lua_State) -> Result,
-{
-    create_callback(state, func);
-}