diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2021-11-14 23:27:20 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2021-11-14 23:27:20 +0000 |
commit | 19bd254e1e35ee79276b2d2c90aee9cc910dc99d (patch) | |
tree | 5b63c878a6f9e22b8c2be3c6d0a38677f2d0ceaa /src | |
parent | 50f20e0c2c4195b3d90fe456d24845a99b532785 (diff) | |
download | mlua-19bd254e1e35ee79276b2d2c90aee9cc910dc99d.zip |
Update comments
Diffstat (limited to 'src')
-rw-r--r-- | src/function.rs | 2 | ||||
-rw-r--r-- | src/thread.rs | 2 | ||||
-rw-r--r-- | src/value.rs | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/src/function.rs b/src/function.rs index 4c7c5f0..efc9da0 100644 --- a/src/function.rs +++ b/src/function.rs @@ -77,7 +77,7 @@ impl<'lua> Function<'lua> { return Err(pop_error(lua.state, ret)); } let nresults = ffi::lua_gettop(lua.state) - stack_start; - let mut results = args; // Recycle MultiValue container + let mut results = args; // Reuse MultiValue container assert_stack(lua.state, 2); for _ in 0..nresults { results.push_front(lua.pop_value()); diff --git a/src/thread.rs b/src/thread.rs index 19db1f8..2f2297b 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -137,7 +137,7 @@ impl<'lua> Thread<'lua> { return Err(pop_error(thread_state, ret)); } - let mut results = args; // Recycle MultiValue container + let mut results = args; // Reuse MultiValue container check_stack(lua.state, nresults + 2)?; // 2 is extra for `lua.pop_value()` below ffi::lua_xmove(thread_state, lua.state, nresults); diff --git a/src/value.rs b/src/value.rs index 1449012..06e88dc 100644 --- a/src/value.rs +++ b/src/value.rs @@ -163,6 +163,7 @@ impl<'lua> MultiValue<'lua> { MultiValue(Vec::new()) } + /// Similar to `new` but can return previously used container with allocated capacity. #[inline] pub(crate) fn new_or_cached(lua: &'lua Lua) -> MultiValue<'lua> { lua.new_or_cached_multivalue() |