Home

Module commodity

Lua bindings to interact with commodities. This will allow you to create and manipulate commodities in-game. An example would be:
 c = commodity.get( "Food" ) -- Gets the commodity by name
 if c:price() > 500 then
 -- Do something with high price
 end
 

Functions

commodity.__eq (o1, o2) Checks to see if two commodities are the same.
commodity.get (s) Gets a commodity.
commodity.name (s) Gets the name of the commodity's commodity.
commodity.price (o) Gets the base price of an commodity.
commodity.priceAt (o, p) Gets the base price of an commodity at a certain planet.


Functions

commodity.__eq (o1, o2)
Checks to see if two commodities are the same.

Parameters

  • o1: First commodity to compare.
  • o2: Second commodity to compare.

Usage:

if o1 == o2 then -- Checks to see if commodity o1 and o2 are the same

Return value:

true if both commodities are the same.
commodity.get (s)
Gets a commodity.

Parameters

  • s: Name of the commodity to get.

Usage:

s = commodity.get( "Food" ) -- Gets the food commodity

Return value:

The commodity matching name or nil if error.
commodity.name (s)
Gets the name of the commodity's commodity.

Parameters

  • s: Commodity to get commodity name.

Usage:

commodityname = s:name()

Return value:

The name of the commodity's commodity.
commodity.price (o)
Gets the base price of an commodity.

Parameters

  • o: Commodity to get information of.

Usage:

print( o:price() ) -- Prints the base price of the commodity

Return value:

The base price of the commodity.
commodity.priceAt (o, p)
Gets the base price of an commodity at a certain planet.

Parameters

  • o: Commodity to get information of.
  • p: Planet to get price at.

Usage:

if o:priceAt( planet.get("Polaris Prime") ) > 100 then -- Checks price of an outfit at polaris prime

Return value:

The price of the commodity at the planet.

Valid XHTML 1.0!