Add ObjectLike::get_path helper

This commit is contained in:
Alex Orlenko
2025-09-04 13:26:16 +01:00
parent 537cc995f6
commit 40b507c3ec
7 changed files with 421 additions and 5 deletions
+12 -1
View File
@@ -1,6 +1,7 @@
use std::string::String as StdString;
use crate::error::{Error, Result};
use crate::state::WeakLua;
use crate::table::Table;
use crate::traits::{FromLua, FromLuaMulti, IntoLua, IntoLuaMulti, ObjectLike};
use crate::userdata::AnyUserData;
@@ -88,6 +89,16 @@ impl ObjectLike for AnyUserData {
#[inline]
fn to_string(&self) -> Result<StdString> {
Value::UserData(AnyUserData(self.0.clone())).to_string()
Value::UserData(self.clone()).to_string()
}
#[inline]
fn to_value(&self) -> Value {
Value::UserData(self.clone())
}
#[inline]
fn weak_lua(&self) -> &WeakLua {
&self.0.lua
}
}