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

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


Functions

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

Parameters:

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

Returns:

    boolean true if both commodities are the same.

Usage:

    if o1 == o2 then -- Checks to see if commodity o1 and o2 are the same
get (s)
Gets a commodity. ( s )

Parameters:

  • s string Name of the commodity to get.

Returns:

    Commodity or nil The commodity matching name or nil if error.

Usage:

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

Parameters:

  • s Commodity Commodity to get commodity name.

Returns:

    string The name of the commodity's commodity.

Usage:

    commodityname = s:name()
price (o)
Gets the base price of an commodity. ( o )

Parameters:

  • o Commodity Commodity to get information of.

Returns:

    number The base price of the commodity.

Usage:

    print( o:price() ) -- Prints the base price of the commodity
priceAt (o, p)
Gets the base price of an commodity at a certain planet. ( o, p )

Parameters:

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

Returns:

    number The price of the commodity at the planet.

Usage:

    if o:priceAt( planet.get("Polaris Prime") ) > 100 then -- Checks price of an outfit at polaris prime
priceAt (o, p, to)
Gets the base price of an commodity at a certain planet at a certain time. ( o, p, t )

Parameters:

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

Returns:

    number The price of the commodity at the planet.

Usage:

    if o:priceAt( planet.get("Polaris Prime"), time ) > 100 then -- Checks price of an outfit at polaris prime
generated by LDoc 1.4.3 Last updated 2020-06-26 02:01:09