<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ocr.michiyo.me/w/index.php?action=history&amp;feed=atom&amp;title=Component%2Fdatabase</id>
	<title>Component/database - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ocr.michiyo.me/w/index.php?action=history&amp;feed=atom&amp;title=Component%2Fdatabase"/>
	<link rel="alternate" type="text/html" href="https://ocr.michiyo.me/w/index.php?title=Component/database&amp;action=history"/>
	<updated>2026-08-24T13:45:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://ocr.michiyo.me/w/index.php?title=Component/database&amp;diff=1150&amp;oldid=prev</id>
		<title>imported&gt;OCDoc Import: Imported from legacy OpenComputers documentation at ocdoc.cil.li</title>
		<link rel="alternate" type="text/html" href="https://ocr.michiyo.me/w/index.php?title=Component/database&amp;diff=1150&amp;oldid=prev"/>
		<updated>2026-08-24T08:08:27Z</updated>

		<summary type="html">&lt;p&gt;Imported from legacy OpenComputers documentation at ocdoc.cil.li&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Component: Database =&lt;br /&gt;
&lt;br /&gt;
This component is provided by the [[Item/database upgrade|database upgrade]].&lt;br /&gt;
&lt;br /&gt;
Component name: `database`.&lt;br /&gt;
&lt;br /&gt;
The database component is primarily useful to work with &amp;quot;full&amp;quot; item stacks, including NBT tags, which are (by default) not available to Lua scripts (to avoid exploits / breaking of other mods&amp;#039; 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.&lt;br /&gt;
&lt;br /&gt;
Callbacks:&lt;br /&gt;
&lt;br /&gt;
* `get(slot:number):table`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Get the representation of the item stack stored in the specified slot.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* `computeHash(slot:number):string`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Computes a hash value for the item stack in the specified slot. This value is guaranteed to be the same for identical item stacks, allowing comparison of item stacks across a network (by comparing the hash values).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* `indexOf(hash:string):number`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Get the index of an item stack with the specified hash. Returns a negative value if no such stack was found.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* `clear(slot:number):boolean`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Clears the specified slot. Returns true if there was something in the slot before.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* `copy(fromSlot:number, toSlot:number[, address:string]):boolean`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Copies an entry to another slot, optionally to another database. Returns true if something was overwritten.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* `clone(address:string):number`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Copies the data stored in this database to another database with the specified address.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Example Use:&lt;br /&gt;
&lt;br /&gt;
```lua local component = require(&amp;quot;component&amp;quot;) local sides = require(&amp;quot;sides&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local db = component.database -- primary database component local invcontrol = component.inventory_controller -- primary inventory controller&lt;br /&gt;
&lt;br /&gt;
-- define slot numbers dbSlot = 1 invSlot = 1&lt;br /&gt;
&lt;br /&gt;
-- compare item inside remote inventory to item in first slot of database if db.get(dbSlot).label == invcontrol.getStackInSlot(sides.north, invSlot).label then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;  -- items match, do stuff with it. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;  -- items don&amp;#039;t match, do nothing, or do something else.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== end ``` ==&lt;br /&gt;
&lt;br /&gt;
{{:Component/contents}}&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>imported&gt;OCDoc Import</name></author>
	</entry>
</feed>