lua/wrappers/game/lua_store.cpp
/**
	 * Attempts to sell the item from the seller character.
	 * Has options for allowing the store to automatically expand by making
	 * new inventories if need be and allowing for the store owner to sell the item
	 * without actually having the coin to pay for the item.
	 *
	 * @param am.character seller The character selling the item.
	 * @param am.item item The item to sell.
	 * @param number [1.0] value_factor A multiplier that affects the cost of the item.
	 * @param boolean [false] make_new_inventory If there is not enough space in the inventories then a new one is made.
	 * @param boolean [false] allow_zero_coin As coin is taken from the store owner to give to the seller, this can force
	 *  the seller to receive the full amount even if the store owner doesn't have the available coin.
	 * @returns am.return_code Return codes for the sale:
	 * <table class='return_codes'>
	 *  <tr><td>success</td><td>The item was sold.</td></tr>
	 *  <tr><td>nil_parameter</td><td>The seller or item was nil.</td></tr>
	 *  <tr><td>no_store_owner</td><td>Cannot sell the item with no store owner.</td></tr>
	 *  <tr><td>no_inventories</td><td>No inventories and make_new_inventory is false.</td></tr>
	 *  <tr><td>not_enough_inventory_space</td><td>Not enough space in the inventories to fit the item and make_new_inventory is false.</td></tr>
	 *  <tr><td>not_enough_coin</td><td>Store owner does not have enough coin to buy the item and allow_zero_coin is false.</td></tr>
	 * </table>
	 */
Attempts to sell the item from the seller character.
Has options for allowing the store to automatically expand by making
new inventories if need be and allowing for the store owner to sell the item
without actually having the coin to pay for the item.

@param am.character seller The character selling the item.
Attempts to sell the item from the seller character . Has options for allowing the store to automatically expand by making new inventories if need be and allowing for the store owner to sell the item without actually having the coin to pay for the item . @param am . character seller The character selling the item .
int Store_sell(lua_State *lua)
	{
		Store *store = castUData<Store>(lua, 1);
		if (store)
		{
			Character *obj = castUData<Character>(lua, 2);
			Item *item = castUData<Item>(lua, 3);
			if (obj && item)
			{
				float factor = 1.0f;
				if (lua_isnum(lua, 4))
				{
					factor = lua_tonumber(lua, 4);
				}
				bool makeNewInventory = false;
				if (lua_isbool(lua, 5))
				{
					makeNewInventory = lua_tobool(lua, 5);
				}
				bool allowZeroCoin = false;
				if (lua_isbool(lua, 6))
				{
					allowZeroCoin = lua_tobool(lua, 6);
				}
				lua_pushinteger(lua, store->sellItem(obj, item, factor, makeNewInventory, allowZeroCoin));
				return 1;
			}
			return LuaState::expectedArgs(lua, "sell", "am.character seller, am.item item, number [1.0] value_factor, boolean [false] make_new_inventory, boolean [false] allow_zero_coin");
		}
		return LuaState::expectedContext(lua, "sell", "am.store");
	}
int Store_sell ( lua_State * lua ) { Store * store = castUData < Store > ( lua , 1 ) ; if ( store ) { Character * obj = castUData < Character > ( lua , 2 ) ; Item * item = castUData < Item > ( lua , 3 ) ; if ( obj && item ) { float factor = 1.0f ; if ( lua_isnum ( lua , 4 ) ) { factor = lua_tonumber ( lua , 4 ) ; } bool makeNewInventory = false ; if ( lua_isbool ( lua , 5 ) ) { makeNewInventory = lua_tobool ( lua , 5 ) ; } bool allowZeroCoin = false ; if ( lua_isbool ( lua , 6 ) ) { allowZeroCoin = lua_tobool ( lua , 6 ) ; } lua_pushinteger ( lua , store -> sellItem ( obj , item , factor , makeNewInventory , allowZeroCoin ) ) ; return 1 ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Attempts to sell the item from the seller character.
Attempts to sell the item from the seller character .