diff options
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | src/error.rs | 4 | ||||
-rw-r--r-- | src/function.rs | 2 | ||||
-rw-r--r-- | src/hook.rs | 2 | ||||
-rw-r--r-- | src/lua.rs | 18 | ||||
-rw-r--r-- | src/serde/ser.rs | 2 | ||||
-rw-r--r-- | src/table.rs | 6 | ||||
-rw-r--r-- | src/userdata.rs | 2 | ||||
-rw-r--r-- | src/util.rs | 2 |
9 files changed, 24 insertions, 24 deletions
@@ -17,7 +17,7 @@ _safe_ (as far as it's possible), high level, easy to use, practical and flexibl Started as [rlua](https://github.com/amethyst/rlua/tree/0.15.3) fork, `mlua` supports Lua 5.4, 5.3, 5.2 and 5.1 including LuaJIT (2.0.5 and 2.1 beta) and allows to write native Lua modules in Rust as well as use Lua in a standalone mode. -`mlua` tested on Windows/macOS/Linux including module mode in [GitHub Actions] on `x86_64` platform and cross-compilation to `aarch64` (other targes are also supported). +`mlua` tested on Windows/macOS/Linux including module mode in [GitHub Actions] on `x86_64` platform and cross-compilation to `aarch64` (other targets are also supported). [GitHub Actions]: https://github.com/khvzak/mlua/actions @@ -25,7 +25,7 @@ Started as [rlua](https://github.com/amethyst/rlua/tree/0.15.3) fork, `mlua` sup ### Feature flags -`mlua` uses feature flags to reduce the amount of depenendies, compiled code and allow to choose only required set of features. +`mlua` uses feature flags to reduce the amount of dependencies, compiled code and allow to choose only required set of features. Below is a list of the available feature flags. By default `mlua` does not enable any features. * `lua54`: activate Lua [5.4] support @@ -73,7 +73,7 @@ With `serialize` feature flag enabled, `mlua` allows you to serialize/deserializ ### Compiling -You have to enable one of the features `lua54`, `lua53`, `lua52`, `lua51` or `luajit`, according to the choosen Lua version. +You have to enable one of the features `lua54`, `lua53`, `lua52`, `lua51` or `luajit`, according to the chosen Lua version. By default `mlua` uses `pkg-config` tool to find lua includes and libraries for the chosen Lua version. In most cases it works as desired, although sometimes could be more preferable to use a custom lua library. @@ -85,7 +85,7 @@ An example how to use them: my_project $ LUA_INC=$HOME/tmp/lua-5.2.4/src LUA_LIB=$HOME/tmp/lua-5.2.4/src LUA_LIB_NAME=lua LUA_LINK=static cargo build ``` -`mlua` also supports vendored lua/luajit using the auxilary crates [lua-src](https://crates.io/crates/lua-src) and +`mlua` also supports vendored lua/luajit using the auxiliary crates [lua-src](https://crates.io/crates/lua-src) and [luajit-src](https://crates.io/crates/luajit-src). Just enable the `vendored` feature and cargo will automatically build and link specified lua/luajit version. This is the easiest way to get started with `mlua`. @@ -233,7 +233,7 @@ If you encounter them, a bug report would be very welcome: + If your program panics with a message that contains the string "mlua internal error", this is a bug. - + Lua C API errors are handled by lonjmp. All instances where the Lua C API would otherwise longjmp over calling stack frames should be guarded against, except in internal callbacks where this is intentional. If you detect that `mlua` is triggering a longjmp over your Rust stack frames, this is a bug! + + Lua C API errors are handled by longjmp. All instances where the Lua C API would otherwise longjmp over calling stack frames should be guarded against, except in internal callbacks where this is intentional. If you detect that `mlua` is triggering a longjmp over your Rust stack frames, this is a bug! + If you detect that, after catching a panic or during a Drop triggered from a panic, a `Lua` or handle method is triggering other bugs or there is a Lua stack space leak, this is a bug. `mlua` instances are supposed to remain fully usable in the face of user generated panics. This guarantee does not extend to panics marked with "mlua internal error" simply because that is already indicative of a separate bug. diff --git a/src/error.rs b/src/error.rs index 652fa74..83d7fb4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -90,7 +90,7 @@ pub enum Error { }, /// [`Thread::resume`] was called on an inactive coroutine. /// - /// A coroutine is inactive if its main function has returned or if an error has occured inside + /// A coroutine is inactive if its main function has returned or if an error has occurred inside /// the coroutine. /// /// [`Thread::status`] can be used to check if the coroutine can be resumed without causing this @@ -154,7 +154,7 @@ pub enum Error { /// Original error returned by the Rust code. cause: Arc<Error>, }, - /// A Rust panic that was previosly resumed, returned again. + /// A Rust panic that was previously resumed, returned again. /// /// This error can occur only when a Rust panic resumed previously was recovered /// and returned again. diff --git a/src/function.rs b/src/function.rs index 9c40d91..fbf192a 100644 --- a/src/function.rs +++ b/src/function.rs @@ -90,7 +90,7 @@ impl<'lua> Function<'lua> { /// Returns a Feature that, when polled, calls `self`, passing `args` as function arguments, /// and drives the execution. /// - /// Internaly it wraps the function to an [`AsyncThread`]. + /// Internally it wraps the function to an [`AsyncThread`]. /// /// Requires `feature = "async"` /// diff --git a/src/hook.rs b/src/hook.rs index 17f2361..2946fc2 100644 --- a/src/hook.rs +++ b/src/hook.rs @@ -11,7 +11,7 @@ use crate::util::callback_error; /// The `Debug` structure is provided as a parameter to the hook function set with /// [`Lua::set_hook`]. You may call the methods on this structure to retrieve information about the /// Lua code executing at the time that the hook function was called. Further information can be -/// found in the [Lua 5.3 documentaton][lua_doc]. +/// found in the [Lua 5.3 documentation][lua_doc]. /// /// [lua_doc]: https://www.lua.org/manual/5.3/manual.html#lua_Debug /// [`Lua::set_hook`]: struct.Lua.html#method.set_hook @@ -97,7 +97,7 @@ pub enum GCMode { Generational, } -/// Controls Lua interpreter behaviour such as Rust panics handling. +/// Controls Lua interpreter behavior such as Rust panics handling. #[derive(Clone, Debug)] #[non_exhaustive] pub struct LuaOptions { @@ -107,7 +107,7 @@ pub struct LuaOptions { /// Also in Lua 5.1 adds ability to provide arguments to [`xpcall`] similar to Lua >= 5.2. /// /// If enabled, keeps [`pcall`]/[`xpcall`] unmodified. - /// Panics are still automatically resumed if returned back to the Rust side. + /// Panics are still automatically resumed if returned to the Rust side. /// /// Default: **true** /// @@ -125,7 +125,7 @@ impl Default for LuaOptions { } impl LuaOptions { - /// Retruns a new instance of `LuaOptions` with default parameters. + /// Returns a new instance of `LuaOptions` with default parameters. pub fn new() -> Self { Self::default() } @@ -206,7 +206,7 @@ impl Lua { /// Creates a new Lua state and loads the specified safe subset of the standard libraries. /// - /// Use the [`StdLib`] flags to specifiy the libraries you want to load. + /// Use the [`StdLib`] flags to specify the libraries you want to load. /// /// # Safety /// The created Lua state would have _some_ safety guarantees and would not allow to load unsafe @@ -243,7 +243,7 @@ impl Lua { /// Creates a new Lua state and loads the specified subset of the standard libraries. /// - /// Use the [`StdLib`] flags to specifiy the libraries you want to load. + /// Use the [`StdLib`] flags to specify the libraries you want to load. /// /// # Safety /// The created Lua state will not have safety guarantees and allow to load C modules. @@ -300,7 +300,7 @@ impl Lua { if !new_ptr.is_null() { mem_info.used_memory += mem_diff; } else if !ptr.is_null() && nsize < osize { - // Should not happend + // Should not happen alloc::handle_alloc_error(new_layout); } @@ -459,7 +459,7 @@ impl Lua { /// Loads the specified subset of the standard libraries into an existing Lua state. /// - /// Use the [`StdLib`] flags to specifiy the libraries you want to load. + /// Use the [`StdLib`] flags to specify the libraries you want to load. /// /// [`StdLib`]: struct.StdLib.html pub fn load_from_std_lib(&self, libs: StdLib) -> Result<()> { @@ -2167,14 +2167,14 @@ impl<'lua, 'a> Chunk<'lua, 'a> { } } - /// Load the chunk function and call it with the given arguemnts. + /// Load the chunk function and call it with the given arguments. /// /// This is equivalent to `into_function` and calling the resulting function. pub fn call<A: ToLuaMulti<'lua>, R: FromLuaMulti<'lua>>(self, args: A) -> Result<R> { self.into_function()?.call(args) } - /// Load the chunk function and asynchronously call it with the given arguemnts. + /// Load the chunk function and asynchronously call it with the given arguments. /// /// See [`Chunk::call`] for more details. /// diff --git a/src/serde/ser.rs b/src/serde/ser.rs index f94d2f7..4b774cb 100644 --- a/src/serde/ser.rs +++ b/src/serde/ser.rs @@ -19,7 +19,7 @@ pub struct Serializer<'lua> { options: Options, } -/// A struct with options to change default serializer behaviour. +/// A struct with options to change default serializer behavior. #[derive(Debug, Clone, Copy)] #[non_exhaustive] pub struct Options { diff --git a/src/table.rs b/src/table.rs index a8e2385..d03275d 100644 --- a/src/table.rs +++ b/src/table.rs @@ -243,10 +243,10 @@ impl<'lua> Table<'lua> { /// Removes a key from the table. /// /// If `key` is an integer, mlua shifts down the elements from `table[key+1]`, - /// and erases element `table[key]`. The complexity is O(n) in worst case, + /// and erases element `table[key]`. The complexity is O(n) in the worst case, /// where n is the table length. /// - /// For othey key types this is equivalent to setting `table[key] = nil`. + /// For other key types this is equivalent to setting `table[key] = nil`. pub fn raw_remove<K: ToLua<'lua>>(&self, key: K) -> Result<()> { let lua = self.0.lua; let key = key.to_lua(lua)?; @@ -378,7 +378,7 @@ impl<'lua> Table<'lua> { /// Consume this table and return an iterator over all values in the sequence part of the table. /// /// The iterator will yield all values `t[1]`, `t[2]`, and so on, until a `nil` value is - /// encountered. This mirrors the behaviour of Lua's `ipairs` function and will invoke the + /// encountered. This mirrors the behavior of Lua's `ipairs` function and will invoke the /// `__index` metamethod according to the usual rules. However, the deprecated `__ipairs` /// metatable will not be called. /// diff --git a/src/userdata.rs b/src/userdata.rs index 133f518..6b84795 100644 --- a/src/userdata.rs +++ b/src/userdata.rs @@ -761,7 +761,7 @@ impl<'lua> AnyUserData<'lua> { /// Returns a metatable of this `UserData`. /// /// Returned [`UserDataMetatable`] object wraps the original metatable and - /// provides safe access to it methods. + /// provides safe access to its methods. /// /// For `T: UserData + 'static` returned metatable is shared among all instances of type `T`. /// diff --git a/src/util.rs b/src/util.rs index e5544f6..e6ba759 100644 --- a/src/util.rs +++ b/src/util.rs @@ -45,7 +45,7 @@ pub struct StackGuard { } impl StackGuard { - // Creates a StackGuard instance with wa record of the stack size, and on Drop will check the + // Creates a StackGuard instance with record of the stack size, and on Drop will check the // stack size and drop any extra elements. If the stack size at the end is *smaller* than at // the beginning, this is considered a fatal logic error and will result in a panic. pub unsafe fn new(state: *mut ffi::lua_State) -> StackGuard { |