PageSourceSearch

https://kashtheking.com/library/assets/js/56e5c6ce.647f5398.js

js kashtheking.com collected 2026-10-02 01:34:50 UTC 16,549 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4279],{85146:e=>{e.exports=JSON.parse('{"functions":[{"name":"doPredicateWarning","desc":"Prints the standard predicate warning for `instance`. Does nothing when `warningName` is nil,\\nwhich is how every factory in this module stays quiet unless you opt in. Useful when writing\\nyour own predicates so they warn in the same format as the built-in ones.\\n\\n```lua\\nlocal function HasPrimaryPart(warningName: string?): Predicates.Predicate\\n\\treturn function(model: Model)\\n\\t\\tif not model.PrimaryPart then\\n\\t\\t\\tPredicates.doPredicateWarning(model, warningName, nil, \\"Missing PrimaryPart\\")\\n\\t\\t\\treturn false\\n\\t\\tend\\n\\t\\treturn true, model.PrimaryPart\\n\\tend\\nend\\n```","params":[{"name":"instance","desc":"The instance that failed; its full name is included in the warning.","lua_type":"Instance"},{"name":"warningName","desc":"Label for the warning (typically the name of your binder or script). Nil suppresses the warning.","lua_type":"string?"},{"name":"warnFormatString","desc":"`string.format` pattern with three `%s`; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"},{"name":"warning","desc":"Why the predicate failed.","lua_type":"string"}],"returns":[],"function_type":"static","source":{"line":146,"path":"packages/src/Predicates/init.luau"}},{"name":"Combine","desc":"Runs several predicates in order and passes only if all of them pass. The extra values of every\\npredicate are concatenated in the same order, so a constructor receives the values of the first\\npredicate, then the second, and so on. The first failing predicate short-circuits the rest.\\n\\n```lua\\nPredicate = Predicates.Combine {\\n\\tPredicates.Attribute(\\"Speed\\", \\"number\\", \\"CarBinder\\"),\\n\\tPredicates.Child(\\"Seat\\", \\"VehicleSeat\\", \\"CarBinder\\"),\\n}\\n-- constructor(instance, trove, speed: number, seat: VehicleSeat)\\n```","params":[{"name":"predicates","desc":"Predicates to run, in order.","lua_type":"{ Predicate }"}],"returns":[{"desc":"A predicate that passes when every input passes and returns all their extra values.","lua_type":"Predicate"}],"function_type":"static","source":{"line":190,"path":"packages/src/Predicates/init.luau"}},{"name":"Attribute","desc":"Requires the instance to have the attribute `attribute` and returns its value as the extra\\nvalue. When `typeValidator` is given the value must also satisfy it.\\n\\n:::caution\\nThe attribute is considered missing when its value is falsy, so a boolean attribute set to\\n`false` fails this predicate. Use a different representation (for example a number or string)\\nfor flags that may be off.\\n:::","params":[{"name":"attribute","desc":"Name of the attribute to read.","lua_type":"string"},{"name":"typeValidator","desc":"Type the value must have; skipped when nil.","lua_type":"TypeValidator?"},{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the attribute value as its extra value.","lua_type":"Predicate"}],"function_type":"static","source":{"line":228,"path":"packages/src/Predicates/init.luau"}},{"name":"Attributes","desc":"Shorthand for [Combine](#Combine) over one [Attribute](#Attribute) predicate per entry of\\n`attributes`. Every listed attribute must exist and match its validator; all of their values are\\nreturned as extra values.\\n\\n:::caution\\n`attributes` is a dictionary, so the order in which the values are returned follows table\\niteration order and is not guaranteed. When you need more than one value in a known order, use\\n[Combine](#Combine) with explicit [Attribute](#Attribute) calls instead.\\n:::","params":[{"name":"attributes","desc":"Attribute names mapped to the type each must have (use `\\"any\\"` to accept anything).","lua_type":"{ [string]: TypeValidator }"},{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with every attribute value as extra values.","lua_type":"Predicate"}],"function_type":"static","source":{"line":269,"path":"packages/src/Predicates/init.luau"}},{"name":"Child","desc":"Requires a direct child named `name` (found with `FindFirstChild`, so it does not wait) and\\nreturns it as the extra value. When `isA` is given the child must also satisfy `IsA(isA)`.","params":[{"name":"name","desc":"Name of the child to find.","lua_type":"string"},{"name":"isA","desc":"Class name the child must be (or inherit from); skipped when nil.","lua_type":"string?"},{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the child instance as its extra value.","lua_type":"Predicate"}],"function_type":"static","source":{"line":294,"path":"packages/src/Predicates/init.luau"}},{"name":"ChildWhichIsA","desc":"Requires a direct child of class `isA` (via `FindFirstChildWhichIsA`, so subclasses count) and\\nreturns the first one found as the extra value.","params":[{"name":"isA","desc":"Class name the child must be or inherit from, e.g. `\\"BasePart\\"`.","lua_type":"string"},{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the matching child as its extra value.","lua_type":"Predicate"}],"function_type":"static","source":{"line":323,"path":"packages/src/Predicates/init.luau"}},{"name":"Descendant","desc":"Requires at least one descendant matching the selector `query` (evaluated with\\n`Instance:QueryDescendants`) and returns the first match as the extra value.","params":[{"name":"query","desc":"Selector string passed to `QueryDescendants`.","lua_type":"string"},{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the first matching descendant as its extra value.","lua_type":"Predicate"}],"function_type":"static","source":{"line":347,"path":"packages/src/Predicates/init.luau"}},{"name":"PrimaryPart","desc":"Requires the instance to be a `Model` with a `PrimaryPart` set. Without `primaryPartPredicate`\\nthe primary part is returned as the extra value. With it, the inner predicate is run against the\\nprimary part and its extra values are returned *instead of* the part itself.\\n\\n```lua\\n-- constructor receives (model, trove, primaryPart)\\nPredicates.PrimaryPart(nil, \\"TurretBinder\\")\\n\\n-- constructor receives (model, trove, range: number) read from the primary part\\nPredicates.PrimaryPart(Predicates.Attribute(\\"Range\\", \\"number\\", \\"TurretBinder\\"), \\"TurretBinder\\")\\n```","params":[{"name":"primaryPartPredicate","desc":"Optional predicate to run on the primary part.","lua_type":"Predicate?"},{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the primary part, or the inner predicate\'s extra values, as extra values.","lua_type":"Predicate"}],"function_type":"static","source":{"line":381,"path":"packages/src/Predicates/init.luau"}},{"name":"IsDescendantOf","desc":"Passes when the instance is a descendant of `ancestor`. Returns no extra values and never\\nwarns. Handy inside [ContextGate](#ContextGate) or [Combine](#Combine) when a Binder\'s own\\n`Ancestors` filter is not enough.","params":[{"name":"ancestor","desc":"The required ancestor.","lua_type":"Instance"}],"returns":[{"desc":"Passes for descendants of `ancestor`.","lua_type":"Predicate"}],"function_type":"static","source":{"line":418,"path":"packages/src/Predicates/init.luau"}},{"name":"Humanoid","desc":"Requires a `Humanoid` child and returns it as the extra value. Equivalent to\\n`ChildWhichIsA(\\"Humanoid\\", ...)`.","params":[{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the Humanoid as its extra value.","lua_type":"Predicate"}],"function_type":"static","source":{"line":434,"path":"packages/src/Predicates/init.luau"}},{"name":"Character","desc":"Requires the instance to look like a character: a `Humanoid` child and a `BasePart` child named\\n`HumanoidRootPart`. Returns the Humanoid, then the HumanoidRootPart, as extra values.","params":[{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with `(humanoid, humanoidRootPart)` as extra values.","lua_type":"Predicate"}],"function_type":"static","source":{"line":448,"path":"packages/src/Predicates/init.luau"}},{"name":"Player","desc":"Finds the `Player` an instance belongs to and returns it as the extra value. It checks, in\\norder: the instance itself as a character model, the nearest `Model` ancestor as a character\\nmodel, and finally a `Player` ancestor (for things parented under `Players.<Name>`, such as\\nitems in a Backpack or PlayerGui). Fails when none of those resolves to a player.","params":[{"name":"warningName","desc":"Enables warnings on failure; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Passes with the owning Player as its extra value.","lua_type":"Predicate"}],"function_type":"static","source":{"line":467,"path":"packages/src/Predicates/init.luau"}},{"name":"ContextGate","desc":"Picks a predicate based on where the code runs: `serverPredicate` on the server,\\n`clientPredicate` on the client. The chosen predicate\'s results (including extra values) are\\nreturned unchanged, so a shared Binder module can demand different things on each side.","params":[{"name":"clientPredicate","desc":"Used when `RunService:IsServer()` is false.","lua_type":"Predicate"},{"name":"serverPredicate","desc":"Used on the server.","lua_type":"Predicate"}],"returns":[{"desc":"Delegates to one of the two predicates.","lua_type":"Predicate"}],"function_type":"static","source":{"line":510,"path":"packages/src/Predicates/init.luau"}},{"name":"StudioOnly","desc":"Warns (when `warningName` is set) if the code is not running in Studio. Note that it **always\\nreturns `true`**; it flags an instance that should not exist in a live game without blocking\\nthe bind. Wrap it in your own predicate if you need it to actually reject.","params":[{"name":"warningName","desc":"Enables the \\"Studio only\\" warning; see [doPredicateWarning](#doPredicateWarning).","lua_type":"string?"},{"name":"warnFormatString","desc":"Custom warning format; defaults to [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING).","lua_type":"string?"}],"returns":[{"desc":"Always passes, warning outside Studio.","lua_type":"Predicate"}],"function_type":"static","source":{"line":531,"path":"packages/src/Predicates/init.luau"}}],"properties":[{"name":"DEFAULT_WARN_FORMAT_STRING","desc":"`\\"[%s] Predicate failed for %s: %s\\"`. The `string.format` pattern used for predicate warnings\\nwhen no `warnFormatString` is supplied. The three `%s` receive the warning name, the instance\'s\\
1nfull name and the failure message, in that order; a custom format string must accept the same\\nthree arguments.","lua_type":"string","readonly":true,"source":{"line":72,"path":"packages/src/Predicates/init.luau"}},{"name":"T","desc":"The bundled [t](/api/t) runtime type-checking library, re-exported for convenience so you can\\nbuild validators without installing it separately (for example `Predicates.T.numberPositive`).\\nSee the [TypeValidator](#TypeValidator) caution before using function validators with\\n[Attribute](#Attribute).","lua_type":"t","readonly":true,"source":{"line":550,"path":"packages/src/Predicates/init.luau"}}],"types":[{"name":"Predicate","desc":"A function that receives the candidate (normally an `Instance`) and returns whether it passes,\\nfollowed by any extra values. Binder passes those extra values to the constructor after the\\nTrove. The first return value must be a real boolean.","lua_type":"(any) -> (boolean, ...any)","source":{"line":61,"path":"packages/src/Predicates/init.luau"}},{"name":"TypeValidator","desc":"Describes the type an attribute must have, for [Attribute](#Attribute) and\\n[Attributes](#Attributes). Either a `typeof` name such as `\\"number\\"`, `\\"string\\"`, `\\"Color3\\"` or\\n`\\"Vector3\\"`, the string `\\"any\\"` (accepts any non-nil value), or a function that receives the\\nvalue and either errors, returns a message, or returns `true`.\\n\\n:::caution\\nIn the current version a function validator is always reported as failing, because the result\\ncheck treats every return value (including `true`) as an error. Use a type-name string until\\nthis is fixed.\\n:::","lua_type":"\\"any\\" | string | (value: any) -> any?","source":{"line":89,"path":"packages/src/Predicates/init.luau"}}],"name":"Predicates","desc":"Ready-made predicate factories for [Binder](/api/Binder). A predicate is a function that\\nreceives a candidate instance and returns `true` or `false`, optionally followed by extra values.\\nBinder forwards those extra values to your constructor, so a predicate both *filters* instances\\nand *collects* the attribute, child, player or part you were going to look up anyway.\\n\\nThe factories live in the `Predicates` sub-table of the module (and are also reachable as\\n`Binder.Predicates.*`). Most accept an optional `warningName`: when it is given, a failing\\npredicate prints a warning formatted with [DEFAULT_WARN_FORMAT_STRING](#DEFAULT_WARN_FORMAT_STRING)\\n(or your own `warnFormatString`) telling you which instance failed and why. Without a\\n`warningName` predicates fail silently.\\n\\n```lua\\nlocal Binder = require(path.to.Binder)\\nlocal Predicates = require(path.to.Predicates).Predicates\\n\\n-- Bind every Model tagged \\"Vendor\\" that has a numeric Price attribute and a\\n-- ProximityPrompt child; the constructor receives them in that order.\\nlocal vendors = Binder.new(function(model: Model, trove, price: number, prompt: ProximityPrompt)\\n\\ttrove:Connect(prompt.Triggered, function(player)\\n\\t\\tprint(`{player.Name} paid {price}`)\\n\\tend)\\n\\n\\treturn trove\\nend, {\\n\\tTags = { \\"Vendor\\" },\\n\\tClassNames = { \\"Model\\" },\\n\\tPredicate = Predicates.Combine {\\n\\t\\tPredicates.Attribute(\\"Price\\", \\"number\\", \\"VendorBinder\\"),\\n\\t\\tPredicates.ChildWhichIsA(\\"ProximityPrompt\\", \\"VendorBinder\\"),\\n\\t},\\n\\tAutoStart = true,\\n})\\n```\\n\\nThe module table is `{ DEFAULT_WARN_FORMAT_STRING, doPredicateWarning, Predicates = { ... },\\nT }`, where `T` is the bundled [t](/api/t) type-checking library for use as a\\n[TypeValidator](#TypeValidator).\\n\\n**Credits:** type validation is done with [t](/api/t), originally by [Osyris](https://github.com/osyrisrblx). Wally installs it.\\n\\nInstallation and guide: [Predicates package page](/docs/packages/predicates).","source":{"line":53,"path":"packages/src/Predicates/init.luau"}}')}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.