API GetBestPriceInfoOfItem

From Vendetta Lua
Revision as of 21:59, 25 January 2009 by Chefkoch (Talk | contribs) (split)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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