We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Value::String::to_pointer
1 parent 2a8db87 commit 930fd9cCopy full SHA for 930fd9c
src/value.rs
@@ -129,9 +129,14 @@ impl Value {
129
#[inline]
130
pub fn to_pointer(&self) -> *const c_void {
131
match self {
132
+ Value::String(String(vref)) => {
133
+ // In Lua < 5.4 (excluding Luau), string pointers are NULL
134
+ // Use alternative approach
135
+ let lua = vref.lua.lock();
136
+ unsafe { ffi::lua_tostring(lua.ref_thread(), vref.index) as *const c_void }
137
+ }
138
Value::LightUserData(ud) => ud.0,
- Value::String(String(vref))
- | Value::Table(Table(vref))
139
+ Value::Table(Table(vref))
140
| Value::Function(Function(vref))
141
| Value::Thread(Thread(vref, ..))
142
| Value::UserData(AnyUserData(vref))
0 commit comments