Skip to content

add support for Value::Other in Value::to_pointer #465

@negrel

Description

@negrel

Hey, I'm using master mlua branch and I want to interact with luajit string.buffer extension which are cdata. I need to retrieve a c_void pointer to convert it into a slice of byte. I noticed that there is a Value::to_pointer method but it doesn't handle the new Value::Other variant introduced few days ago.

Is there a way to get a pointer from a Value::Other or this should be handled in this function ?

diff --git a/src/value.rs b/src/value.rs
index e68f753..9a77a46 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -137,6 +137,7 @@ impl Value {
             | Value::Table(Table(vref))
             | Value::Function(Function(vref))
             | Value::Thread(Thread(vref, ..))
+            | Value::Other(vref)
             | Value::UserData(AnyUserData(vref, ..)) => vref.to_pointer(),
             #[cfg(feature = "luau")]
             Value::Buffer(crate::Buffer(vref)) => vref.to_pointer(),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions