Chame como
Platform.runes.numberField(self, value, missing)
Registre a dependência Platform.runes.numberField e depois chame-a por esse nome. Uma chamada com namespace não passa self: use uma chamada com dois-pontos ou passe o objeto você mesmo.
O que faz
Normalizes one numeric field of a native result. Returns the value when it is a readable finite number (sign and fractions kept); otherwise nil with "restricted-value", the caller-supplied missing reason when the value is nil, or "invalid-api-result".
Argumentos
| Nome | Tipo | O que faz |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
value | any | Field value from the native result. |
missing | string | Reason to return when value is nil, such as rune-start-unavailable. |
Retornos
| 1 | number | nil | The finite value, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason when the value is nil. |
Edições
As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.
- Indisponível nessa edição (o motivo está na dica)
- Só enquanto as alternativas da Blizzard para APIs obsoletas estiverem ativas
| API do jogo | |||||
|---|---|---|---|---|---|
canaccessvalue |
Valores secretos (Retail e Forever)
No Retail e no Forever, o jogo entrega valores secretos aos addons. Esta função auxiliar verifica o que lê (addon.Platform:CanReadValue) e retorna nil com um motivo como restricted-value em vez de um valor secreto que não consegue comparar. Trate nil como indisponível, não como false.
Como o addon a chama
Platform.runes.GetRuneCooldownObservationrecord.start,record.startReason=numberField(self,tuple[1],'rune-start-unavailable')Platform.runes.GetRuneEvaluationTimereturn numberField(self,value,'rune-time-unavailable')Platform.runes.GetRuneTypeObservationlocal runeType,why=numberField(self,value,'rune-type-unavailable')
Dependências
finite→Platform.runes.finite
Código-fonte
Platform/runes.lua, linha 36. Somente leitura no jogo; Duplicar cria uma cópia editável.
Platform.runes.numberField(self, value, missing)
if not self:CanReadValue(value) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(value) then return nil,'restricted-value' end
if value==nil then return nil,missing end
if not finite(value) then return nil,'invalid-api-result' end
return value




