Rename `LuaTable::has` to `contains_key`
This is what all Rust maps use
This commit is contained in:
parent
ed210e88b5
commit
a47a6e32ef
|
@ -233,7 +233,7 @@ impl<'lua> LuaTable<'lua> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks whether the table contains a non-nil value for `key`.
|
/// Checks whether the table contains a non-nil value for `key`.
|
||||||
pub fn has<K: ToLua<'lua>>(&self, key: K) -> LuaResult<bool> {
|
pub fn contains_key<K: ToLua<'lua>>(&self, key: K) -> LuaResult<bool> {
|
||||||
let lua = self.0.lua;
|
let lua = self.0.lua;
|
||||||
let key = key.to_lua(lua)?;
|
let key = key.to_lua(lua)?;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn test_load() {
|
||||||
"#,
|
"#,
|
||||||
None,
|
None,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
assert!(module.has("func").unwrap());
|
assert!(module.contains_key("func").unwrap());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
module
|
module
|
||||||
.get::<_, LuaFunction>("func")
|
.get::<_, LuaFunction>("func")
|
||||||
|
|
Loading…
Reference in New Issue