Update chunk! documentation
This commit is contained in:
parent
24bbd62564
commit
8aae9a7c3e
15
src/lib.rs
15
src/lib.rs
|
@ -139,9 +139,9 @@ extern crate mlua_derive;
|
||||||
/// This macro allows to write Lua code directly in Rust code.
|
/// This macro allows to write Lua code directly in Rust code.
|
||||||
///
|
///
|
||||||
/// Rust variables can be referenced from Lua using `$` prefix, as shown in the example below.
|
/// Rust variables can be referenced from Lua using `$` prefix, as shown in the example below.
|
||||||
/// User Rust types needs to implement [`UserData`] or [`ToLua`] traits.
|
/// User's Rust types needs to implement [`UserData`] or [`ToLua`] traits.
|
||||||
///
|
///
|
||||||
/// Captured variables are moved into the chunk.
|
/// Captured variables are **moved** into the chunk.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use mlua::{Lua, Result, chunk};
|
/// use mlua::{Lua, Result, chunk};
|
||||||
|
@ -165,12 +165,19 @@ extern crate mlua_derive;
|
||||||
/// (Single quoted strings only work if they contain a single character, since in Rust,
|
/// (Single quoted strings only work if they contain a single character, since in Rust,
|
||||||
/// `'a'` is a character literal).
|
/// `'a'` is a character literal).
|
||||||
///
|
///
|
||||||
|
/// - Using Lua comments `--` is not desirable in **stable** Rust and can have bad side effects.
|
||||||
|
///
|
||||||
|
/// This is because procedural macros have Line/Column information available only in
|
||||||
|
/// **nightly** Rust. Instead, Lua chunks represented as a big single line of code in stable Rust.
|
||||||
|
///
|
||||||
|
/// As workaround, Rust comments `//` can be used.
|
||||||
|
///
|
||||||
/// Other minor limitations:
|
/// Other minor limitations:
|
||||||
///
|
///
|
||||||
/// - Certain escape codes in string literals.
|
/// - Certain escape codes in string literals don't work.
|
||||||
/// (Specifically: `\a`, `\b`, `\f`, `\v`, `\123` (octal escape codes), `\u`, and `\U`).
|
/// (Specifically: `\a`, `\b`, `\f`, `\v`, `\123` (octal escape codes), `\u`, and `\U`).
|
||||||
///
|
///
|
||||||
/// These are accepted: : `\\`, `\n`, `\t`, `\r`, `\xAB` (hex escape codes), and `\0`
|
/// These are accepted: : `\\`, `\n`, `\t`, `\r`, `\xAB` (hex escape codes), and `\0`.
|
||||||
///
|
///
|
||||||
/// - The `//` (floor division) operator is unusable, as its start a comment.
|
/// - The `//` (floor division) operator is unusable, as its start a comment.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue