This component is provided by the database upgrade.
Component name: database
.
The database component is primarily useful to work with “full” item stacks, including NBT tags, which are (by default) not available to Lua scripts (to avoid exploits / breaking of other mods' gameplay). Some components allow specifying item stacks by instead specifying the address of a database component, and slot the item stack is in that database - for example, the Export Bus driver for Applied Energistics 2 makes use of this functionality.
Callbacks:
get(slot:number):table
computeHash(slot:number):string
indexOf(hash:string):number
clear(slot:number):boolean
copy(fromSlot:number, toSlot:number[, address:string]):boolean
clone(address:string):number
Example Use:
local component = require("component") local sides = require("sides") local db = component.database -- primary database component local invcontrol = component.inventory_controller -- primary inventory controller -- define slot numbers dbSlot = 1 invSlot = 1 -- compare item inside remote inventory to item in first slot of database if db.get(dbSlot).label == invcontrol.getStackInSlot(sides.north, invSlot).label then -- items match, do stuff with it. else -- items don't match, do nothing, or do something else. end
Components | 3D Printer - Abstract Bus - Access Point - Chunkloader - Computer - Crafting - Data Card - Database - Debug - Drone - Drive - EEPROM - Experience - Filesystem - Generator - Geolyzer - GPU - Hologram - Internet - Inventory Controller - Leash - Microcontroller - Modem - Motion Sensor - Navigation - Net Splitter - Piston - Redstone - Redstone in Motion - Robot - Screen - Sign - Tank Controller - Tractor Beam - Transposer - Tunnel - World Sensor | |
---|---|---|
Others | Component Access - Signals | |
Cross-Mod Integration | Applied Energistics |