Example #1
0
/*
 * Method: GetEquipmentPrice
 *
 * Get the price of an equipment or cargo item traded at this station
 *
 * > price = station:GetEquipmentPrice(equip)
 *
 * Parameters:
 *
 *   equip - the <Constants.EquipType> string for the equipment or cargo item
 *
 * Returns:
 *
 *   price - the price of the equipment or cargo item
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   experimental
 */
static int l_spacestation_get_equipment_price(lua_State *l)
{
	SpaceStation *s = LuaSpaceStation::GetFromLua(1);
	Equip::Type e = static_cast<Equip::Type>(LuaConstants::GetConstant(l, "EquipType", luaL_checkstring(l, 2)));
	Sint64 cost = s->GetPrice(e);
	lua_pushnumber(l, cost * 0.01);
	return 1;
}