获取属性接口

This commit is contained in:
Lenheart 2025-11-09 11:38:38 +08:00
parent e45fa5b862
commit 6ac9e059fb
1 changed files with 10 additions and 6 deletions

View File

@ -385,23 +385,23 @@ function deepcopy(obj) {
function _deepcopy(obj, copies) { function _deepcopy(obj, copies) {
local type = typeof obj; local type = typeof obj;
// 处理基本类型 // 处理基本类型
if (type != "table" && type != "array" && type != "class" && type != "instance") { if (type != "table" && type != "array" && type != "class" && type != "instance") {
return obj; return obj;
} }
// 处理循环引用 // 处理循环引用
if (obj in copies) { if (obj in copies) {
return copies[obj]; return copies[obj];
} }
// 创建新容器 // 创建新容器
local newObj; local newObj;
if (type == "array") { if (type == "array") {
newObj = array(obj.len()); newObj = array(obj.len());
copies[obj] <- newObj; // 在拷贝前记录 copies[obj] <- newObj; // 在拷贝前记录
for (local i = 0; i < obj.len(); i++) { for (local i = 0; i < obj.len(); i++) {
newObj[i] = _deepcopy(obj[i], copies); newObj[i] = _deepcopy(obj[i], copies);
} }
@ -409,7 +409,7 @@ function _deepcopy(obj, copies) {
else if (type == "table") { else if (type == "table") {
newObj = {}; newObj = {};
copies[obj] <- newObj; // 在拷贝前记录 copies[obj] <- newObj; // 在拷贝前记录
foreach(key, val in obj) { foreach(key, val in obj) {
// 键也需要深拷贝 // 键也需要深拷贝
local newKey = _deepcopy(key, copies); local newKey = _deepcopy(key, copies);
@ -421,6 +421,10 @@ function _deepcopy(obj, copies) {
newObj = obj; newObj = obj;
copies[obj] <- newObj; copies[obj] <- newObj;
} }
return newObj; return newObj;
}
function sq_GetCharacterAttribute(address){
return L_sq_GetCharacterAttribute(address);
} }