Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
component:database [2015/01/14 23:40]
127.0.0.1 external edit
component:database [2015/08/12 21:30]
rashy
Line 22: Line 22:
   Copies the data stored in this database to another database with the specified address.   Copies the data stored in this database to another database with the specified address.
  
 +
 +Example Use:
 +
 +```lua
 +local component = require("​component"​)
 +local sides = require("​sides"​)
 +
 +local db = component.database -- primary database component
 +local invcontrol = component.inventory_controller -- primary inventory controller
 +
 +-- compare item inside remote inventory to item in first slot of database
 +if db.get(1).label == invcontrol.getStackInSlot(sides.north,​ 1).label then
 + -- items match, do stuff with it. 
 +else
 + -- items don't match, do nothing, or do something else.
 +end
 +```
 ---- ----
  
 {{page>​component:​contents&​noheader&​noeditbutton&​nouser&​nofooter}} {{page>​component:​contents&​noheader&​noeditbutton&​nouser&​nofooter}}