Skip to content

Commit a7f105c

Browse files
committed
Update Lua::set_memory_category doc
1 parent d2a8670 commit a7f105c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/luau/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl Lua {
2727
///
2828
/// The category "main" is reserved for the default memory category.
2929
/// Maximum of 255 categories can be registered.
30+
/// The category is set per Lua thread (state) and affects all allocations made from that
31+
/// thread.
3032
///
3133
/// Return error if too many categories are registered or if the category name is invalid.
3234
///
@@ -55,22 +57,20 @@ impl Lua {
5557
}
5658
}
5759
};
58-
unsafe { ffi::lua_setmemcat(lua.main_state(), cat_id as i32) };
60+
unsafe { ffi::lua_setmemcat(lua.state(), cat_id as i32) };
5961

6062
Ok(())
6163
}
6264

63-
/// Dumps the current Lua heap state.
65+
/// Dumps the current Lua VM heap state.
6466
///
6567
/// The returned `HeapDump` can be used to analyze memory usage.
6668
/// It's recommended to call [`Lua::gc_collect`] before dumping the heap.
6769
#[cfg(any(feature = "luau", doc))]
6870
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
6971
pub fn heap_dump(&self) -> Result<HeapDump> {
7072
let lua = self.lock();
71-
unsafe {
72-
heap_dump::HeapDump::new(lua.main_state()).ok_or_else(|| Error::runtime("unable to dump heap"))
73-
}
73+
unsafe { heap_dump::HeapDump::new(lua.state()).ok_or_else(|| Error::runtime("unable to dump heap")) }
7474
}
7575

7676
pub(crate) unsafe fn configure_luau(&self) -> Result<()> {

0 commit comments

Comments
 (0)