Important!
The Table Cloth is only available as a peripheral if it's a store or if there's items on it. It will remain a peripheral as long as there is a computer/modem/turtle attached to it, even if it is emptied.
Method | Description |
---|---|
getAddress() | Gets the Table Cloth's address |
getPriceTagCount() | Gets the pricetag item count |
getPriceTagItem() | Gets the pricetag item |
getWares() | Gets the items being sold |
isShop() | Returns true if it's a store |
setAddress(address) | Sets the Table Cloth's address |
setPriceTagCount([count]) | Sets the pricetag item count |
setPriceTagItem([name]) | Sets the pricetag item |
setWares([item], ...) | Sets the items being sold with their counts |
getAddress()
Gets the Table Cloth's address.
Returns
string
With the address currently in use.
getPriceTagCount()
Gets the Table Cloth's Pricetag item count.
Returns
number
Number of items.
getPriceTagItem()
Gets the Item used for the Table Cloth's price tag.
Returns
table
Table of itemDetails.
getWares()
Gets the list of items requested on purchase.
Returns
table
Table of itemDetails.
isShop()
Checks if the Table Cloth is a shop or not.
Returns
boolean
, True if it's a shop.
setAddress(address)
Sets the Table Cloth's address to the given variable.
If the address arg is nil, it'll unset the address.
Parameters
- address:
string
Addresses processed pruchases to address.
setPriceTagCount([count])
Sets the Table Cloth's Pricetag item count.
Parameters
- count?:_
count = 1
Sets the count tocount
.
setPriceTagItem([name])
Sets the Item used for the Table Cloth's price tag.
Parameters
- name?:_
string = nil
Sets the Item toname
. Unsets if name isnil
.
setWares(item, ...)
Sets the Table Cloth's wares that get requested on purchase.
- Each argument represents an item to be requested and is a table of the item
name
, likecreate:wrench
orapple
and thecount
, between1
and256
. - nil argument or a table with an unspecified
name
equates to an empty slot. - Unspecified
count
equates to1
- If no items are provided, the tablecloth stops being a shop, and goes back to normal behaviour.
Parameters
- item:
table
Table ofname = string
andcount = number
. You can have up to 9item
args.
Usage
tableCloth = peripheral.find("Create_TableCloth")
if tableCloth then -- makes sure the tablecloth exists, in case it was wrapped while it wasn't a store/inventory
tableCloth.setWares(
{ name = "minecraft:diamond"}, -- defaults to 1
{ name = "redstone", count = 30 }
)
tableCloth.setPriceTagItem("gold_ingot")
tableCloth.setPriceTagCount(2)
end