Skip to main content

Predicates

@0.2.3

Composable predicate functions for instances: attributes, children, characters, players, and combinations.

Predicates is a library of factories that build (instance) -> (boolean, ...) functions: require an attribute of a given type, a child or descendant of a class, a PrimaryPart, a Humanoid, a character or a Player, gate on server/client, and Combine several into one. Passing predicates hand their findings back as extra return values, which is how Binder feeds them into your constructor. Type checks come from t.

Use it when​

  • You need a readable, reusable filter instead of an inline if part:IsA(...) and part:GetAttribute(...).
  • You are writing a Binder and want its filter as a named predicate.

Install​

Studio Wally​

Using the Studio Wally plugin:

  1. Open the widget.
  2. Search kashtheking/predicates.
  3. Press download and choose Shared module (recommended for almost every package).

Wally​

Add this to the [dependencies] section of your wally.toml, then run wally install:

Predicates = "kashtheking/predicates@0.2.3"
local Predicates = require(ReplicatedStorage.Packages.Predicates)

Dependencies​

Wally installs these automatically:

Credits​

Type validation uses t, originally by Osyris.

API​

Every constructor, method, property and type is documented on the Predicates API page, generated from the doc comments in init.luau. Each entry links to its line in the source.

Help​

Questions and bug reports: the Discord or a GitHub issue. See Help & contact for everything else.