Skip to content

Commit 2fbbbe4

Browse files
Fix minor grammar mistakes in README.md (#591)
1 parent f002083 commit 2fbbbe4

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
>
2424
> See v0.10 [release notes](https://github.com/mlua-rs/mlua/blob/main/docs/release_notes/v0.10.md).
2525
26-
`mlua` is bindings to [Lua](https://www.lua.org) programming language for Rust with a goal to provide
27-
_safe_ (as far as it's possible), high level, easy to use, practical and flexible API.
26+
`mlua` is a set of bindings to the [Lua](https://www.lua.org) programming language for Rust with a goal to provide a
27+
_safe_ (as much as possible), high level, easy to use, practical and flexible API.
2828

29-
Started as `rlua` fork, `mlua` supports Lua 5.4, 5.3, 5.2, 5.1 (including LuaJIT) and [Luau] and allows to write native Lua modules in Rust as well as use Lua in a standalone mode.
29+
Started as an `rlua` fork, `mlua` supports Lua 5.4, 5.3, 5.2, 5.1 (including LuaJIT) and [Luau] and allows writing native Lua modules in Rust as well as using Lua in a standalone mode.
3030

31-
`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).
31+
`mlua` is tested on Windows/macOS/Linux including module mode in [GitHub Actions] on `x86_64` platforms and cross-compilation to `aarch64` (other targets are also supported).
3232

3333
WebAssembly (WASM) is supported through `wasm32-unknown-emscripten` target for all Lua/Luau versions excluding JIT.
3434

@@ -39,7 +39,7 @@ WebAssembly (WASM) is supported through `wasm32-unknown-emscripten` target for a
3939

4040
### Feature flags
4141

42-
`mlua` uses feature flags to reduce the amount of dependencies, compiled code and allow to choose only required set of features.
42+
`mlua` uses feature flags to reduce the amount of dependencies and compiled code, and allow to choose only required set of features.
4343
Below is a list of the available feature flags. By default `mlua` does not enable any features.
4444

4545
* `lua54`: enable Lua [5.4] support
@@ -51,12 +51,12 @@ Below is a list of the available feature flags. By default `mlua` does not enabl
5151
* `luau`: enable [Luau] support (auto vendored mode)
5252
* `luau-jit`: enable [Luau] support with JIT backend.
5353
* `luau-vector4`: enable [Luau] support with 4-dimensional vector.
54-
* `vendored`: build static Lua(JIT) library from sources during `mlua` compilation using [lua-src] or [luajit-src] crates
54+
* `vendored`: build static Lua(JIT) libraries from sources during `mlua` compilation using [lua-src] or [luajit-src]
5555
* `module`: enable module mode (building loadable `cdylib` library for Lua)
5656
* `async`: enable async/await support (any executor can be used, eg. [tokio] or [async-std])
5757
* `send`: make `mlua::Lua: Send + Sync` (adds [`Send`] requirement to `mlua::Function` and `mlua::UserData`)
5858
* `error-send`: make `mlua:Error: Send + Sync`
59-
* `serialize`: add serialization and deserialization support to `mlua` types using [serde] framework
59+
* `serialize`: add serialization and deserialization support to `mlua` types using [serde]
6060
* `macros`: enable procedural macros (such as `chunk!`)
6161
* `anyhow`: enable `anyhow::Error` conversion into Lua
6262
* `userdata-wrappers`: opt into `impl UserData` for `Rc<T>`/`Arc<T>`/`Rc<RefCell<T>>`/`Arc<Mutex<T>>` where `T: UserData`
@@ -78,7 +78,7 @@ Below is a list of the available feature flags. By default `mlua` does not enabl
7878

7979
`mlua` supports async/await for all Lua versions including Luau.
8080

81-
This works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6) and require running [Thread](https://docs.rs/mlua/latest/mlua/struct.Thread.html) along with enabling `feature = "async"` in `Cargo.toml`.
81+
This works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6) and requires running [Thread](https://docs.rs/mlua/latest/mlua/struct.Thread.html) along with enabling `feature = "async"` in `Cargo.toml`.
8282

8383
**Examples**:
8484
- [HTTP Client](examples/async_http_client.rs)
@@ -102,7 +102,7 @@ curl -v http://localhost:3000
102102

103103
### Serialization (serde) support
104104

105-
With `serialize` feature flag enabled, `mlua` allows you to serialize/deserialize any type that implements [`serde::Serialize`] and [`serde::Deserialize`] into/from [`mlua::Value`]. In addition `mlua` provides [`serde::Serialize`] trait implementation for it (including `UserData` support).
105+
With the `serialize` feature flag enabled, `mlua` allows you to serialize/deserialize any type that implements [`serde::Serialize`] and [`serde::Deserialize`] into/from [`mlua::Value`]. In addition, `mlua` provides the [`serde::Serialize`] trait implementation for it (including `UserData` support).
106106

107107
[Example](examples/serialize.rs)
108108

@@ -114,24 +114,24 @@ With `serialize` feature flag enabled, `mlua` allows you to serialize/deserializ
114114

115115
You have to enable one of the features: `lua54`, `lua53`, `lua52`, `lua51`, `luajit(52)` or `luau`, according to the chosen Lua version.
116116

117-
By default `mlua` uses `pkg-config` tool to find lua includes and libraries for the chosen Lua version.
118-
In most cases it works as desired, although sometimes could be more preferable to use a custom lua library.
119-
To achieve this, mlua supports `LUA_LIB`, `LUA_LIB_NAME` and `LUA_LINK` environment variables.
117+
By default `mlua` uses `pkg-config` to find Lua includes and libraries for the chosen Lua version.
118+
In most cases it works as desired, although sometimes it may be preferable to use a custom Lua library.
119+
To achieve this, mlua supports the `LUA_LIB`, `LUA_LIB_NAME` and `LUA_LINK` environment variables.
120120
`LUA_LINK` is optional and may be `dylib` (a dynamic library) or `static` (a static library, `.a` archive).
121121

122-
An example how to use them:
122+
An example of how to use them:
123123
``` sh
124124
my_project $ LUA_LIB=$HOME/tmp/lua-5.2.4/src LUA_LIB_NAME=lua LUA_LINK=static cargo build
125125
```
126126

127-
`mlua` also supports vendored lua/luajit using the auxiliary crates [lua-src](https://crates.io/crates/lua-src) and
127+
`mlua` also supports vendored Lua/LuaJIT using the auxiliary crates [lua-src](https://crates.io/crates/lua-src) and
128128
[luajit-src](https://crates.io/crates/luajit-src).
129-
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`.
129+
Just enable the `vendored` feature and cargo will automatically build and link the specified Lua/LuaJIT version. This is the easiest way to get started with `mlua`.
130130

131131
### Standalone mode
132-
In a standalone mode `mlua` allows to add to your application scripting support with a gently configured Lua runtime to ensure safety and soundness.
132+
In standalone mode, `mlua` allows adding scripting support to your application with a gently configured Lua runtime to ensure safety and soundness.
133133

134-
Add to `Cargo.toml` :
134+
Add to `Cargo.toml`:
135135

136136
``` toml
137137
[dependencies]
@@ -159,11 +159,11 @@ fn main() -> LuaResult<()> {
159159
```
160160

161161
### Module mode
162-
In a module mode `mlua` allows to create a compiled Lua module that can be loaded from Lua code using [`require`](https://www.lua.org/manual/5.4/manual.html#pdf-require). In this case `mlua` uses an external Lua runtime which could lead to potential unsafety due to unpredictability of the Lua environment and usage of libraries such as [`debug`](https://www.lua.org/manual/5.4/manual.html#6.10).
162+
In module mode, `mlua` allows creating a compiled Lua module that can be loaded from Lua code using [`require`](https://www.lua.org/manual/5.4/manual.html#pdf-require). In this case `mlua` uses an external Lua runtime which could lead to potential unsafety due to the unpredictability of the Lua environment and usage of libraries such as [`debug`](https://www.lua.org/manual/5.4/manual.html#6.10).
163163

164164
[Example](examples/module)
165165

166-
Add to `Cargo.toml` :
166+
Add to `Cargo.toml`:
167167

168168
``` toml
169169
[lib]
@@ -173,7 +173,7 @@ crate-type = ["cdylib"]
173173
mlua = { version = "0.10", features = ["lua54", "module"] }
174174
```
175175

176-
`lib.rs` :
176+
`lib.rs`:
177177

178178
``` rust
179179
use mlua::prelude::*;
@@ -216,14 +216,14 @@ rustflags = [
216216
```
217217
On Linux you can build modules normally with `cargo build --release`.
218218

219-
On Windows the target module will be linked with `lua5x.dll` library (depending on your feature flags).
219+
On Windows the target module will be linked with the `lua5x.dll` library (depending on your feature flags).
220220
Your main application should provide this library.
221221

222-
Module builds don't require Lua lib or headers to be installed on the system.
222+
Module builds don't require Lua binaries or headers to be installed on the system.
223223

224224
### Publishing to luarocks.org
225225

226-
There is a LuaRocks build backend for mlua modules [`luarocks-build-rust-mlua`].
226+
There is a LuaRocks build backend for mlua modules: [`luarocks-build-rust-mlua`].
227227

228228
Modules written in Rust and published to luarocks:
229229
- [`decasify`](https://github.com/alerque/decasify)
@@ -236,19 +236,19 @@ Modules written in Rust and published to luarocks:
236236

237237
## Safety
238238

239-
One of the `mlua` goals is to provide *safe* API between Rust and Lua.
240-
Every place where the Lua C API may trigger an error longjmp in any way is protected by `lua_pcall`,
241-
and the user of the library is protected from directly interacting with unsafe things like the Lua stack,
242-
and there is overhead associated with this safety.
239+
One of `mlua`'s goals is to provide a *safe* API between Rust and Lua.
240+
Every place where the Lua C API may trigger an error longjmp is protected by `lua_pcall`,
241+
and the user of the library is protected from directly interacting with unsafe things like the Lua stack.
242+
There is overhead associated with this safety.
243243

244244
Unfortunately, `mlua` does not provide absolute safety even without using `unsafe` .
245245
This library contains a huge amount of unsafe code. There are almost certainly bugs still lurking in this library!
246246
It is surprisingly, fiendishly difficult to use the Lua C API without the potential for unsafety.
247247

248248
## Panic handling
249249

250-
`mlua` wraps panics that are generated inside Rust callbacks in a regular Lua error. Panics could be
251-
resumed then by returning or propagating the Lua error to Rust code.
250+
`mlua` wraps panics that are generated inside Rust callbacks in a regular Lua error. Panics can then be
251+
resumed by returning or propagating the Lua error to Rust code.
252252

253253
For example:
254254
``` rust
@@ -267,12 +267,12 @@ let _ = lua.load(r#"
267267
unreachable!()
268268
```
269269

270-
Optionally `mlua` can disable Rust panics catching in Lua via `pcall`/`xpcall` and automatically resume
270+
Optionally, `mlua` can disable Rust panic catching in Lua via `pcall`/`xpcall` and automatically resume
271271
them across the Lua API boundary. This is controlled via `LuaOptions` and done by wrapping the Lua `pcall`/`xpcall`
272-
functions on a way to prevent catching errors that are wrapped Rust panics.
272+
functions to prevent catching errors that are wrapped Rust panics.
273273

274274
`mlua` should also be panic safe in another way as well, which is that any `Lua` instances or handles
275-
remains usable after a user generated panic, and such panics should not break internal invariants or
275+
remain usable after a user generated panic, and such panics should not break internal invariants or
276276
leak Lua stack space. This is mostly important to safely use `mlua` types in Drop impls, as you should not be
277277
using panics for general error handling.
278278

@@ -289,12 +289,12 @@ If you encounter them, a bug report would be very welcome:
289289

290290
## Sandboxing
291291

292-
Please check the [Luau Sandboxing] page if you are interested in running untrusted Lua scripts in controlled environment.
292+
Please check the [Luau Sandboxing] page if you are interested in running untrusted Lua scripts in a controlled environment.
293293

294-
`mlua` provides `Lua::sandbox` method for enabling sandbox mode (Luau only).
294+
`mlua` provides the `Lua::sandbox` method for enabling sandbox mode (Luau only).
295295

296296
[Luau Sandboxing]: https://luau.org/sandbox
297297

298298
## License
299299

300-
This project is licensed under the [MIT license](LICENSE)
300+
This project is licensed under the [MIT license](LICENSE).

0 commit comments

Comments
 (0)