Call as
Conditions.spatial.protectedRead(cache, method, ...)
Record the dependency Conditions.spatial.protectedRead, 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
Packaged helper from Conditions/spatial.lua.
Arguments
| Name | Type | What it does |
|---|---|---|
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
method | function | Function to call; any other value returns false and missing-api. |
... | any | Arguments forwarded to method. |
Returns
| 1 | boolean | True when the call succeeded, as pcall reports it. |
|---|---|---|
| 2 | any | On success, every result of method; on failure, the error message or missing-api. |
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
- Distance Count (evaluate)
local ok,current=protectedRead(cache,UnitGUID,entity.unit) Conditions.spatial.booleanReadlocal ok,result=protectedRead(cache,method,...)
Source
Functions/cache.lua, line 24. Read only in game; Duplicate makes an editable copy.
Conditions.spatial.protectedRead(cache, method, ...)
if type(method)~="function" then return false,"missing-api" end
return pcall(addon.getCached,cache,method,...)