Aufruf als
Conditions.spatial.booleanRead(cache, method, ...)
Erfassen Sie die Abhängigkeit Conditions.spatial.booleanRead und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.
Was sie bewirkt
Calls a yes/no game API through the evaluation cache, protected against errors, for the distance conditions. Accepts nil, false and 0 as no and true and 1 as yes; a missing API, an error, a restricted value or any other answer gives nil with a reason.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
method | function | Game API to call, such as UnitExists or UnitIsEnemy. |
... | any | Arguments forwarded to method. |
Rückgabewerte
| 1 | boolean | nil | The answer, or nil when it cannot be read. |
|---|---|---|
| 2 | string | nil | Reason for nil: missing-api, api-error, restricted-value or invalid-api-result. |
Editionen
Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.
Sie liest keine Spiel-API direkt.
Geheime Werte (Retail und Forever)
Auf Retail und Forever übergibt das Spiel Addons geheime Werte. Diese Hilfsfunktion prüft, was sie liest (addon.Platform:CanReadValue), und gibt statt eines geheimen Werts, den sie nicht vergleichen kann, nil mit einem Grund wie restricted-value zurück. Behandeln Sie nil als nicht verfügbar, nicht als false.
Wie das Addon sie aufruft
- Anzahl in Entfernung (evaluate)
local present,issue=booleanRead(cache,UnitExists,entity.unit) Conditions.spatial.combatFilterlocal fighting,why=booleanRead(cache,UnitAffectingCombat,unit)Conditions.spatial.nameplateDistanceCountlocal present,issue=booleanRead(cache,UnitExists,unit)
Abhängigkeiten
protectedRead→Conditions.spatial.protectedRead
Quelle
Conditions/spatial.lua, Zeile 73. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
Conditions.spatial.booleanRead(cache, method, ...)
local ok,result=protectedRead(cache,method,...)
if not ok then return nil,result=="missing-api" and result or "api-error" end
if not addon.Platform:CanReadValue(result) then return nil,"restricted-value" end
if result==nil or result==false or result==0 then return false end
if result==true or result==1 then return true end
return nil,"invalid-api-result"