Skip to content
Tim edited this page Sep 19, 2015 · 3 revisions

These follow the syntax described in Syntax.

Match a value

Matcher Matches
_ anything
true true
truthy anything but false or nil
false false
falsy false or nil
nil nil
-- match identity of objects
ref(reference)

--- match general identity: `expected == actual`
equal(value)
equals(value)

tables/lists

--- match deep compared tables
same(table)
--- match sets
unique(deep)

--- match subsets
is_subset_of(table)
--- match values that are set to a key or any key of a table
is_value_of(table, [key])

numbers

near(value, tolerance)

strings

match(pattern, [init, [plain]])
matches(pattern, [init, [plain]])

pattern, init are defined as with string.match. If plain is defined, string.find is used instead. Also see the chapter on patterns.

Match a type()

  • boolean
  • number
  • string
  • table
  • nil
  • userdata
  • function
  • thread

Match a composite

none_of(matchers, ...)
any_of(matchers, ...)
all_of(matchers, ...)

Match an Item

--- match anything that is in creative inventory
in_creative_inventory(itemdef_or_name)

Clone this wiki locally