Skip to content

Commit 8aae9a7

Browse files
committed
Update chunk! documentation
1 parent 24bbd62 commit 8aae9a7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/lib.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ extern crate mlua_derive;
139139
/// This macro allows to write Lua code directly in Rust code.
140140
///
141141
/// Rust variables can be referenced from Lua using `$` prefix, as shown in the example below.
142-
/// User Rust types needs to implement [`UserData`] or [`ToLua`] traits.
142+
/// User's Rust types needs to implement [`UserData`] or [`ToLua`] traits.
143143
///
144-
/// Captured variables are moved into the chunk.
144+
/// Captured variables are **moved** into the chunk.
145145
///
146146
/// ```
147147
/// use mlua::{Lua, Result, chunk};
@@ -165,12 +165,19 @@ extern crate mlua_derive;
165165
/// (Single quoted strings only work if they contain a single character, since in Rust,
166166
/// `'a'` is a character literal).
167167
///
168+
/// - Using Lua comments `--` is not desirable in **stable** Rust and can have bad side effects.
169+
///
170+
/// This is because procedural macros have Line/Column information available only in
171+
/// **nightly** Rust. Instead, Lua chunks represented as a big single line of code in stable Rust.
172+
///
173+
/// As workaround, Rust comments `//` can be used.
174+
///
168175
/// Other minor limitations:
169176
///
170-
/// - Certain escape codes in string literals.
177+
/// - Certain escape codes in string literals don't work.
171178
/// (Specifically: `\a`, `\b`, `\f`, `\v`, `\123` (octal escape codes), `\u`, and `\U`).
172179
///
173-
/// These are accepted: : `\\`, `\n`, `\t`, `\r`, `\xAB` (hex escape codes), and `\0`
180+
/// These are accepted: : `\\`, `\n`, `\t`, `\r`, `\xAB` (hex escape codes), and `\0`.
174181
///
175182
/// - The `//` (floor division) operator is unusable, as its start a comment.
176183
///

0 commit comments

Comments
 (0)