Referenz › Funktionsreferenz › Conditions

Conditions.spatial.booleanRead

Abhängigkeit

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

NameTypWas sie bewirkt
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.
methodfunctionGame API to call, such as UnitExists or UnitIsEnemy.
...anyArguments forwarded to method.

Rückgabewerte

1boolean | nilThe answer, or nil when it cannot be read.
2string | nilReason 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

Abhängigkeiten

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"

Zurück zu Funktionsreferenz