low-luajit 0.1.0

Low level but safe bindings to the LuaJIT C API with no dependencies and no-std support to create Lua modules using Rust.
Documentation
use crate::{LuaState, ffi};

/// Nil (& none) related functions.
impl LuaState {
	/// Returns `true` if the value at the given acceptable `index` is `nil`, `false` otherwise.
	#[inline]
	#[must_use]
	pub fn is_nil(&self, index: i32) -> bool {
		// SAFETY: self.0 is always valid.
		unsafe { ffi::lua_isnil(self.0, index) != 0 }
	}

	/// Returns `true` if the value at the given acceptable `index` is invalid (out of bounds), `false` otherwise.
	#[inline]
	#[must_use]
	pub fn is_none(&self, index: i32) -> bool {
		// SAFETY: self.0 is always valid.
		unsafe { ffi::lua_isnone(self.0, index) != 0 }
	}

	/// Returns `true` if the value at the given acceptable `index` is `nil` or invalid (out of bounds), `false` otherwise.
	#[inline]
	#[must_use]
	pub fn is_none_or_nil(&self, index: i32) -> bool {
		// SAFETY: self.0 is always valid.
		unsafe { ffi::lua_isnoneornil(self.0, index) != 0 }
	}

	/// Pushes `nil` onto the stack.
	#[inline]
	pub fn push_nil(&mut self) {
		// SAFETY: self.0 is always valid.
		unsafe { ffi::lua_pushnil(self.0); }
	}
}