魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[Foreach] Pet

[复制链接]
发表于 6 天前 | 显示全部楼层 |阅读模式

Pet
Foreach.Pet(PetFunction)
函数功能
对所有在线宠物执行指定函数(PetFunction)。

参数说明
PetFunction: 函数型 可执行的lua函数。
返回值
执行成功的次数。 -1为参数错误。

PetFunction(CharIndex)
参数说明
CharIndex: 数值型 宠物对象Index。
返回值


参考实例
-- 定义一个PetFunction
function MyForeachPet(CharIndex)
  print("MyForeachPet: "..CharIndex.." called"..Char.GetData(CharIndex, %對象_CDK%))
  return 0
end

Foreach.Pet(MyForeachPet); -- 对所有在线宠物批量执行PetFunction
回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-16 08:45 , Processed in 0.174199 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表