summaryrefslogtreecommitdiff
path: root/src/sheet/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sheet/mod.rs')
-rw-r--r--src/sheet/mod.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/sheet/mod.rs b/src/sheet/mod.rs
index f67d55e..501b71e 100644
--- a/src/sheet/mod.rs
+++ b/src/sheet/mod.rs
@@ -90,7 +90,7 @@ impl Clone for Sheet {
}
}
-struct SheetLuaRef {
+pub struct SheetLuaRef {
id: SheetId,
}
@@ -98,6 +98,10 @@ impl SheetLuaRef {
pub fn new(id: SheetId) -> Self {
Self { id }
}
+
+ pub fn id(&self) -> SheetId {
+ self.id
+ }
}
impl LuaUserData for SheetLuaRef {
@@ -122,3 +126,13 @@ impl LuaUserData for SheetLuaRef {
})
}
}
+
+impl<'lua> FromLua<'lua> for SheetLuaRef {
+ fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult<Self> {
+ if let Some(ud) = value.as_userdata() {
+ ud.take()
+ } else {
+ Err(LuaError::runtime("failed to parse sheet"))
+ }
+ }
+}