Repository navigation
API Queries
Lua API / Queries
Resource registry search methods are documented in References. Recipe searches have their own criteria.
On this page
All specified filters must match. Missing criteria mean no filter.
local matches = betamoon.items:find {
nameContains = "pickaxe",
ignoreCase = true,
where = function(item) return item.maxDamage > 100 end
}| Field | Type | Meaning |
|---|---|---|
id |
integer | Exact numeric ID. |
damage |
integer or table | Exact metadata, or inclusive { min = a, max = b } / { a, b } range. Omitted endpoints are unbounded. |
name |
string | Exact internal name comparison. |
displayName |
string | Exact translated display-name comparison. |
nameContains |
string | Substring in internal name. |
ignoreCase |
boolean | Case-insensitive text comparisons; default false. |
type |
string | Item type, compared case-insensitively. |
owner |
string | Owner comparison, case-insensitive. |
where |
function(reference) | Additional predicate; a truthy result includes the reference. |
Results contain references in numeric order, alongside the helper methods below.
Returns the first element, or nil when empty.
local first = matches:first()Returns the last element, or nil when empty.
local last = matches:last()Returns the only element. Empty lists return nil; more than one element raises a Lua error.
local only = betamoon.blocks:find { id = 1 }:one()Returns a boolean indicating whether the list contains zero results.
if matches:isEmpty() then return endApplies one override definition to each reference and returns a one-based list of individual override handles. Each target is processed separately; this is not an atomic transaction. A non-table definition is an error.
local handles = betamoon.blocks:find { id = 3 }:overrideAll {
displayName = "Garden Dirt"
}See Overrides for conditions and handle removal.
Examples: Block queries, item queries.
- Installation
- Install scripts
- Getting started
- VS Code and LuaLS
- Examples
- Reload and compatibility
- Troubleshooting
- Changelog
Scripts and shared values
- Script lifecycle
- Packaged Lua mods
- Modules
- References and stacks
- Queries
- Overrides
- Minecraft constants
- Chat and positions
- Structured data
- Script configuration
- Particles
Blocks and items
- Multiblocks
- Blocks
- Block state and placement
- Block shapes and rendering
- Block callbacks
- Block ticks and redstone
- Items
- Fluids
- Item callbacks
- Tools and armor
- Materials
- Textures
Entities
- Entities
- Entity access and movement
- Entity lifecycle and data
- Entity health and loot
- Entity inventories and relationships
- Projectiles and pickups
- Entity presentation and sounds
- Living entities and AI
- Entity parts and sensors
Assets and audio
- Assets
- Models and animations
- Built-in Minecraft models
- Model appearances
- Blockbench workflow
- Audio
- Texture-pack overrides
Events and world actions
World generation
World systems
Inventories and screens
Recipes