diff --git a/Cargo.lock b/Cargo.lock index 3c706e4..d96d1b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,7 +109,7 @@ dependencies = [ [[package]] name = "gmod" -version = "4.0.2" +version = "4.0.3" dependencies = [ "cfg_table", "cstr", diff --git a/gmod/Cargo.toml b/gmod/Cargo.toml index 913f80d..d2d2359 100644 --- a/gmod/Cargo.toml +++ b/gmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gmod" -version = "4.0.2" +version = "4.0.3" authors = ["William Venner "] edition = "2018" license = "MIT" diff --git a/gmod/src/lua/import.rs b/gmod/src/lua/import.rs index afff2a7..c2767e9 100644 --- a/gmod/src/lua/import.rs +++ b/gmod/src/lua/import.rs @@ -8,7 +8,7 @@ macro_rules! find_library { }; } -use super::{LuaError, State as LuaState, lua_state::LuaDebug}; +use super::{LuaError, State as LuaState, LuaDebug}; pub type LuaInt = isize; pub type LuaSize = usize; diff --git a/gmod/src/lua/lua_state.rs b/gmod/src/lua/lua_state.rs index d9342ef..7534373 100644 --- a/gmod/src/lua/lua_state.rs +++ b/gmod/src/lua/lua_state.rs @@ -470,38 +470,3 @@ impl std::ops::Deref for LuaState { &self.0 } } - -#[derive(Clone, Copy)] -#[repr(C)] -pub struct LuaDebug { - pub event: i32, - pub name: LuaString, - pub namewhat: LuaString, - pub what: LuaString, - pub source: LuaString, - pub currentline: i32, - pub nups: i32, - pub linedefined: i32, - pub lastlinedefined: i32, - pub short_src: [std::os::raw::c_char; LUA_IDSIZE], - i_ci: i32 -} -impl std::fmt::Debug for LuaDebug { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - unsafe { - f.debug_struct("LuaDebug") - .field("event", &self.event) - .field("name", &std::ffi::CStr::from_ptr(self.name)) - .field("namewhat", &std::ffi::CStr::from_ptr(self.namewhat)) - .field("what", &std::ffi::CStr::from_ptr(self.what)) - .field("source", &std::ffi::CStr::from_ptr(self.source)) - .field("currentline", &self.currentline) - .field("nups", &self.nups) - .field("linedefined", &self.linedefined) - .field("lastlinedefined", &self.lastlinedefined) - .field("short_src", &std::ffi::CStr::from_ptr(self.short_src.as_ptr())) - .field("i_ci", &self.i_ci) - .finish() - } - } -} diff --git a/gmod/src/lua/mod.rs b/gmod/src/lua/mod.rs index b048236..6105577 100644 --- a/gmod/src/lua/mod.rs +++ b/gmod/src/lua/mod.rs @@ -77,4 +77,39 @@ macro_rules! lua_stack_guard { #[cfg(not(debug_assertions))] $code }}; -} \ No newline at end of file +} + +#[derive(Clone, Copy)] +#[repr(C)] +pub struct LuaDebug { + pub event: i32, + pub name: LuaString, + pub namewhat: LuaString, + pub what: LuaString, + pub source: LuaString, + pub currentline: i32, + pub nups: i32, + pub linedefined: i32, + pub lastlinedefined: i32, + pub short_src: [std::os::raw::c_char; LUA_IDSIZE], + i_ci: i32 +} +impl std::fmt::Debug for LuaDebug { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + unsafe { + f.debug_struct("LuaDebug") + .field("event", &self.event) + .field("name", &std::ffi::CStr::from_ptr(self.name)) + .field("namewhat", &std::ffi::CStr::from_ptr(self.namewhat)) + .field("what", &std::ffi::CStr::from_ptr(self.what)) + .field("source", &std::ffi::CStr::from_ptr(self.source)) + .field("currentline", &self.currentline) + .field("nups", &self.nups) + .field("linedefined", &self.linedefined) + .field("lastlinedefined", &self.lastlinedefined) + .field("short_src", &std::ffi::CStr::from_ptr(self.short_src.as_ptr())) + .field("i_ci", &self.i_ci) + .finish() + } + } +}