Skip to content

Commit

Permalink
more informative destructed userdata conversion error
Browse files Browse the repository at this point in the history
  • Loading branch information
Y0SH1M4S73R committed Aug 25, 2024
1 parent 5d6a846 commit 54e4de2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/value/conversion/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ impl<'lua> FromLua<'lua> for Value {
LuaValue::UserData(u) if u.is::<ByondObject>() => {
u.borrow::<ByondObject>().map(|r| Value(r.0.clone()))
}
LuaValue::UserData(_) => Err(LuaError::FromLuaConversionError {
from: "destructed userdata",
to: "BYOND value",
message: Some(String::from(
"The associated object has been cleared from lua memory",
)),
}),
LuaValue::Table(t) => convert_from_table(lua, t),
LuaValue::Vector(v) => [v.x(), v.y(), v.z()]
.to_byond()
Expand Down

0 comments on commit 54e4de2

Please sign in to comment.