Merge pull request #5 from JoshPiper/feat/is_menu

feat: Adds LUA.is_menu()
This commit is contained in:
William 2022-01-13 22:21:23 +00:00 committed by GitHub
commit 4cc22fcf5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -35,6 +35,14 @@ impl LuaState {
server
}
/// Returns whether this is the menu Lua state or not.
pub unsafe fn is_menu(&self) -> bool {
self.get_global(crate::lua_string!("MENU_DLL"));
let menu = self.get_boolean(-1);
self.pop();
menu
}
/// Returns the Lua string as a slice of bytes.
///
/// **WARNING:** This will CHANGE the type of the value at the given index to a string.