Call as
Conditions.misc.validWhole(value)
Record the dependency Conditions.misc.validWhole, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.
What it does
Checks that a value can be a difficulty or instance ID: a whole number from 0 up to 2^31.
Arguments
| Name | Type | What it does |
|---|---|---|
value | any | The value to test. |
Returns
| 1 | boolean | True for a valid whole number. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
How the addon calls it
- Instance (valid)
and (value.difficulty == nil or validWhole(value.difficulty))
Source
Conditions/misc.lua, line 311. Read only in game; Duplicate makes an editable copy.
Conditions.misc.validWhole(value)
return type(value) == "number" and value == value and value >= 0 and value < 2^31 and value % 1 == 0