keyword
keyword <iterable> <word>…
Whether any word produced by an iterable exactly matches (ignoring case) any of the given words.
keyword takes an iterable of strings followed by one or
more candidate words. It is true when some word in the iterable equals
some candidate, compared case-insensitively. This is the equality-based
sibling of abbrev, which matches by prefix instead.
Because a bare string is not iterable, convert one with
words first.
Arguments
<iterable>— an iterable yielding strings (for example fromwordsoralias).<word>…— one or more candidate strings; the call takes two or more arguments in total.
Returns
A bool — true if any iterable word equals any candidate (case-insensitive), false otherwise.
Examples
after command (say) {
do "say keyword=[keyword [words 'chat gossip'] hi gossip]."
}
The iterable yields chat and gossip; gossip matches the candidate
gossip, so [keyword ...] is true.
after command (say) {
require [keyword [alias $self] puff dragon]
do "say Yes, that's one of my names."
}
This guard passes when one of the owner's name aliases is
exactly puff or dragon; otherwise the script advances to the next
matching handler (see require).
See also
abbrev— the same shape, but matching by prefix abbreviation.ismember,hasabbrev— equality / abbreviation against a single value.words— turn a string into an iterable of words.- Iterables and iterables