logoHourGlass
Foreach.Pet

Foreach.Pet

Foreach.Pet(PetFunction)

函數功能

對所有在線寵物執行指定函數(PetFunction)。

參數說明

  • PetFunction函數型 可執行的lua函數。

返回值

執行成功的次數。 -1爲參數錯誤。

語法

PetFunction(CharIndex)

參數說明

返回值

參考實例

-- 定義一個PetFunction
function MyForeachPet(CharIndex)
  print("MyForeachPet: "..CharIndex.." called"..Char.GetData(CharIndex, %對象_CDK%))
  return 0
end

Foreach.Pet(MyForeachPet); -- 對所有在線寵物批量執行PetFunction