Reference › Function reference › Conditions

Conditions.spatial.protectedRead

dependency

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

NameTypeWhat it does
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.
methodfunctionFunction to call; any other value returns false and missing-api.
...anyArguments forwarded to method.

Returns

1booleanTrue when the call succeeded, as pcall reports it.
2anyOn 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

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,...)

Back to Function reference