Chiamala come
Core.health_forecast_conditions.readField(platform, object, key)
Registra la dipendenza Core.health_forecast_conditions.readField, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.
Cosa fa
Reads object[key] for the health-forecast conditions without letting a restricted value, a non-table object or an index error escape.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
platform | RMPlatform | Platform whose CanReadValue decides readability. |
object | any | Table to read, such as a damage history record. |
key | any | Key to read. |
Valori restituiti
| 1 | any | The field's value (possibly nil), or nil on failure. |
|---|---|---|
| 2 | string | nil | Reason on failure: restricted-value, invalid-health-forecast-data or health-forecast-data-error. |
Edizioni
Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.
Non legge direttamente alcuna API di gioco.
Valori segreti (Retail e Forever)
Su Retail e Forever il gioco fornisce agli addon valori segreti. Questa funzione di supporto controlla ciò che legge (addon.Platform:CanReadValue) e restituisce nil con un motivo come restricted-value invece di un valore segreto che non può confrontare. Considera nil come non disponibile, non come false.
Come la chiama l'addon
Core.health_forecast_conditions.GetConditionHealthForecastcurrent,why=readField(platform,provider,'current')
Sorgente
Core/health_forecast_conditions.lua, riga 35. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Core.health_forecast_conditions.readField(platform, object, key)
if not platform:CanReadValue(object) then return nil,'restricted-value' end
if type(object)~='table' then return nil,'invalid-health-forecast-data' end
local ok,value=pcall(function() return object[key] end)
if not ok then return nil,'health-forecast-data-error' end
if not platform:CanReadValue(value) then return nil,'restricted-value' end
return value