Skip to content

Info ​

Debugging only

VideState.info exists to inspect registered rules while you debug. Do not use it to drive game logic. Build features from rules and handlers instead.

Every rule registers its RuleMetadata under its name when it is created. Info reads that registry back. It never creates, changes, or removes a rule.

Tags ​

Tags come from the tags field of a rule's metadata. VideState never formats them: it does not trim, lowercase, or otherwise change a tag. "Menu", "menu", and " menu " are three different tags. Keeping tags consistent is your responsibility.

Functions ​

get Added in 0.1.0 ​

luau
VideState.info.get(
    name: string -- The name the rule was registered with
) -> RuleMetadata?

Looks up the metadata of a registered rule. Returns nil when no rule has that name.

Parameters

NameTypeDescription
namestringThe name given in the rule's metadata.

Returns

TypeDescription
RuleMetadata?A frozen copy of the metadata, or nil when no rule is registered under name.

getAllRulesWithTags Added in 0.1.0 ​

luau
VideState.info.getAllRulesWithTags(
    ...: string -- The tags a rule must have
) -> { RuleMetadata }

Returns every registered rule that has all of the given tags. Tags are matched exactly as written.

Parameters

NameTypeDescription
...stringThe tags to look for. At least one is required. A rule must have every tag to be included.

Returns

TypeDescription
{ RuleMetadata }A frozen array of the matching rules' metadata, sorted by rule name. It is empty when no rule matches.

Errors

CauseMessage
ErrorNo tags are givengetAllRulesWithTags requires at least one tag
ErrorA tag is not a stringTag <n> must be a string, got <type>

getAllTags Added in 0.1.0 ​

luau
VideState.info.getAllTags() -> { string }

Returns every tag used by a registered rule.

Returns

TypeDescription
{ string }A frozen array of distinct tags, sorted alphabetically. Rules without tags add nothing.

ruleHasTag Added in 0.1.0 ​

luau
VideState.info.ruleHasTag(
    ruleName: string, -- The name the rule was registered with
    tag: string -- The tag to look for
) -> boolean

Checks whether a rule has a tag. The tag is matched exactly as written.

Parameters

NameTypeDescription
ruleNamestringThe name given in the rule's metadata.
tagstringThe tag to look for.

Returns

TypeDescription
booleantrue when the rule has the tag. false when it does not, or when no rule is registered under ruleName.

Errors

CauseMessage
ErrorruleName is not a stringRule name must be a string, got <type>
Errortag is not a stringTag must be a string, got <type>

Registration ​

VideState.rules.dynamic registers each rule for you. Do not call info.register or info.setTags yourself. Use addTags and removeTags to change a rule's tags. info.register raises Duplicate rule name: <name> when a name is already registered, which is the same error that rules.dynamic raises for a duplicate name.