Component/trading: Difference between revisions
Jump to navigation
Jump to search
imported>OCDoc Import Imported from legacy OpenComputers documentation at ocdoc.cil.li |
Clean up Markdown artifacts from DokuWiki migration |
||
| Line 3: | Line 3: | ||
This component is provided by [[item/trading_upgrade|trading upgrades]] | This component is provided by [[item/trading_upgrade|trading upgrades]] | ||
Component name: | Component name: <code>trading</code>. Callbacks: | ||
* | * <code>getTrades():table</code> | ||
<pre>Returns a table of trades in range as userdata objects. | <pre>Returns a table of trades in range as userdata objects. | ||
| Line 13: | Line 13: | ||
A trade object represents an available trade nearby. | A trade object represents an available trade nearby. | ||
* | * <code>isEnabled():boolean</code> | ||
<pre>Returns whether the merchant currently wants to trade this. | <pre>Returns whether the merchant currently wants to trade this. | ||
</pre> | </pre> | ||
* | * <code>trade():boolean, string</code> | ||
<pre>Returns true when trade succeeds and nil, error when not. | <pre>Returns true when trade succeeds and nil, error when not. | ||
</pre> | </pre> | ||
* | * <code>getInput():table, table</code> | ||
<pre>Returns the items the merchant wants for this trade. | <pre>Returns the items the merchant wants for this trade. | ||
</pre> | </pre> | ||
* | * <code>getOutput():table</code> | ||
<pre>Returns the item the merchant offers for this trade. | <pre>Returns the item the merchant offers for this trade. | ||
</pre> | </pre> | ||
* | * <code>getMerchantId():number</code> | ||
<pre>Returns the id of the merchant that provides this trade. Trades can be grouped by the merchant offering them using this id. The id is created when you call getTrades(), but is consistent as long as the group of available merchants does not change between calls. | <pre>Returns the id of the merchant that provides this trade. Trades can be grouped by the merchant offering them using this id. The id is created when you call getTrades(), but is consistent as long as the group of available merchants does not change between calls. | ||
</pre> | </pre> | ||
| Line 37: | Line 37: | ||
{{:Component/contents}} | {{:Component/contents}} | ||
Latest revision as of 20:28, 24 August 2026
Component: Trading
This component is provided by trading upgrades
Component name: trading. Callbacks:
getTrades():table
Returns a table of trades in range as userdata objects.
Trade Object
A trade object represents an available trade nearby.
isEnabled():boolean
Returns whether the merchant currently wants to trade this.
trade():boolean, string
Returns true when trade succeeds and nil, error when not.
getInput():table, table
Returns the items the merchant wants for this trade.
getOutput():table
Returns the item the merchant offers for this trade.
getMerchantId():number
Returns the id of the merchant that provides this trade. Trades can be grouped by the merchant offering them using this id. The id is created when you call getTrades(), but is consistent as long as the group of available merchants does not change between calls.
| Components | |
|---|---|
| Core Components | Access Point - Computer - Drone - Drive - EEPROM - Filesystem - GPU - Microcontroller - Modem - Redstone - Robot - Transposer |
| Others | Component Access - Signals |
| Cross-Mod Integration | Applied Energistics |