use crate::{LuaState, ffi::{self, lua_gc}};
impl LuaState {
#[inline]
pub fn gc(&self, what: i32, data: i32) -> i32 {
unsafe { lua_gc(self.0, what, data) }
}
#[inline]
pub fn gc_stop(&self) {
self.gc(ffi::LUA_GCSTOP, 0);
}
#[inline]
pub fn gc_restart(&self) {
self.gc(ffi::LUA_GCRESTART, 0);
}
#[inline]
pub fn gc_collect(&self) {
self.gc(ffi::LUA_GCCOLLECT, 0);
}
#[inline]
#[must_use]
pub fn gc_count(&self) -> i32 {
self.gc(ffi::LUA_GCCOUNT, 0)
}
#[inline]
#[must_use]
pub fn gc_count_b(&self) -> i32 {
self.gc(ffi::LUA_GCCOUNTB, 0)
}
#[inline]
pub fn gc_step(&self, size: i32) -> bool {
self.gc(ffi::LUA_GCSTEP, size) != 0
}
#[inline]
pub fn gc_set_pause(&self, pause: i32) -> i32 {
self.gc(ffi::LUA_GCSETPAUSE, pause)
}
#[inline]
pub fn gc_set_step_multiplier(&self, step_multiplier: i32) -> i32 {
self.gc(ffi::LUA_GCSETSTEPMUL, step_multiplier)
}
#[inline]
pub fn gc_is_running(&self) -> bool {
self.gc(ffi::LUA_GCISRUNNING, 0) != 0
}
}