Support setting metatable for Lua builtin types.

Closes #445
This commit is contained in:
Alex Orlenko
2024-09-23 10:45:57 +01:00
parent 16951e3628
commit ca69be07ff
9 changed files with 215 additions and 19 deletions
+6 -2
View File
@@ -1,7 +1,7 @@
use std::borrow::Borrow;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::os::raw::c_void;
use std::os::raw::{c_int, c_void};
use std::string::String as StdString;
use std::{cmp, fmt, slice, str};
@@ -13,7 +13,7 @@ use {
use crate::error::{Error, Result};
use crate::state::Lua;
use crate::types::ValueRef;
use crate::types::{LuaType, ValueRef};
/// Handle to an internal Lua string.
///
@@ -327,6 +327,10 @@ impl<'a> IntoIterator for BorrowedBytes<'a> {
}
}
impl LuaType for String {
const TYPE_ID: c_int = ffi::LUA_TSTRING;
}
#[cfg(test)]
mod assertions {
use super::*;