lua/wrappers/game/lua_store.cpp
/**
	 * Returns the inventory at the given index, returns nil if outside of the number of inventories.
	 *
	 * @param integer index The index to get the inventory from.
	 * @returns am.inventory The inventory at the given index.
	 */
Returns the inventory at the given index, returns nil if outside of the number of inventories.
@param integer index The index to get the inventory from.
@returns am.inventory The inventory at the given index.
Returns the inventory at the given index returns nil if outside of the number of inventories . @param integer index The index to get the inventory from . @returns am . inventory The inventory at the given index .
int Store_inventory(lua_State *lua)
	{
		Store *store = castUData<Store>(lua, 1);
		if (store)
		{
			if (lua_isnum(lua, 2))
			{
				int index = lua_tointeger(lua, 2);
				auto inventories = store->getStoreInventories();
				if (index < 0 || index >= static_cast<int>(inventories.size()))
				{
					std::stringstream ss;
					ss << "Unable to get inventory at index " << index << ", there are " << inventories.size() << " inventories in this store.";
					LuaState::warning(lua, ss.str().c_str());
					lua_pushnil(lua);
					return 1;
				}
				Inventory *inv = inventories[index];
				wrapRefObject<Inventory>(lua, inv);
				return 1;
			}
			return LuaState::expectedArgs(lua, "inventory", "integer index");
		}
		return LuaState::expectedContext(lua, "inventory", "am.store");
	}
int Store_inventory ( lua_State * lua ) { Store * store = castUData < Store > ( lua , 1 ) ; if ( store ) { if ( lua_isnum ( lua , 2 ) ) { int index = lua_tointeger ( lua , 2 ) ; auto inventories = store -> getStoreInventories ( ) ; if ( index < 0 || index >= static_cast < int > ( inventories . size ( ) ) ) { std :: stringstream ss ; ss << " " << index << " " << inventories . size ( ) << " " ; LuaState :: warning ( lua , ss . str ( ) . c_str ( ) ) ; lua_pushnil ( lua ) ; return 1 ; } Inventory * inv = inventories [ index ] ; wrapRefObject < Inventory > ( lua , inv ) ; return 1 ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Returns the inventory at the given index, returns nil if outside of the number of inventories.
Returns the inventory at the given index returns nil if outside of the number of inventories .