API GetBestPriceInfoOfItem

From Vendetta Lua
Jump to: navigation, search

GetBestPriceInfoOfItem

Definition:
GetBestPriceInfoOfItem(int item) -> int price, station
Description:
Get highest sell price of a cargo item in the active ship in the currentsystem
Arguments:
item itemid of cargo item
Returns:
price highest price in system
station locationid of station with highest price
Example:

-- print best prices in system for all cargo items in the ship
for _,item in ipairs(GetShipInventory(GetActiveShipID()).cargo) do
	local price, station = GetBestPriceInfoOfItem(item)
	print(GetInventoryItemName(item).." "..tostring(price).."c at "..LocationStr(math.floor(station / 100)))
end