mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-20 14:47:45 +00:00
Return nil when pop range isn't found
This commit is contained in:
parent
227c8c1eb2
commit
0d95f0d5b8
1 changed files with 3 additions and 4 deletions
|
@ -147,17 +147,16 @@ impl UserData for Zone {
|
||||||
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
|
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
|
||||||
methods.add_method(
|
methods.add_method(
|
||||||
"get_pop_range",
|
"get_pop_range",
|
||||||
|_, this, id: u32| -> mlua::Result<Position> {
|
|lua: &Lua, this, id: u32| -> mlua::Result<mlua::Value> {
|
||||||
if let Some(pop_range) = this.find_pop_range(id) {
|
if let Some(pop_range) = this.find_pop_range(id) {
|
||||||
let trans = pop_range.0.transform.translation;
|
let trans = pop_range.0.transform.translation;
|
||||||
return Ok(Position {
|
return lua.pack(Position {
|
||||||
x: trans[0],
|
x: trans[0],
|
||||||
y: trans[1],
|
y: trans[1],
|
||||||
z: trans[2],
|
z: trans[2],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// FIXME: return nil?
|
Ok(mlua::Nil)
|
||||||
Ok(Position::default())
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue