Fix warning when compiling for lua51

This commit is contained in:
Alex Orlenko 2023-06-03 14:24:34 +01:00
parent 1dc32452e6
commit 9596f2e9ee
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,4 @@
use std::cell::RefCell;
use std::ffi::CStr;
use std::mem;
use std::os::raw::{c_int, c_void};
use std::ptr;
@ -325,7 +324,7 @@ impl<'lua> Function<'lua> {
// Traverse upvalues until we find the _ENV one
match ffi::lua_getupvalue(state, -1, i) {
s if s.is_null() => break,
s if CStr::from_ptr(s as _).to_bytes() == b"_ENV" => break,
s if std::ffi::CStr::from_ptr(s as _).to_bytes() == b"_ENV" => break,
_ => ffi::lua_pop(state, 1),
}
}
@ -374,7 +373,7 @@ impl<'lua> Function<'lua> {
for i in 1..=255 {
match ffi::lua_getupvalue(state, -1, i) {
s if s.is_null() => return Ok(false),
s if CStr::from_ptr(s as _).to_bytes() == b"_ENV" => {
s if std::ffi::CStr::from_ptr(s as _).to_bytes() == b"_ENV" => {
ffi::lua_pop(state, 1);
// Create an anonymous function with the new environment
let f_with_env = lua