How do I update an entity? I have defined my own entity: 'game'; created some 'games' with entity_create; and loaded one of these 'games' into a form for editing. Now, I want to update the entity with my submit handler. Here is the relevant code inside the handler:

$game = entity_load_single('game', $form_state['values']['game_id']);
$wrapper = entity_metadata_wrapper('game', $game);
$wrapper-&gt;some_property-&gt;set($form_state['values']['some_value']);
$wrapper-&gt;save();


This throws:


  Error
  
  EntityMetadataWrapperException: Entity property some_property doesn't
  support writing. in EntityStructureWrapper->setProperty() (line 493 of
  /.../sites/all/modules/contrib/entity/includes/entity.wrapper.inc).


I was looking for a function like entity_update, but it doesn't seem to exist. How can I update my 'game' entities? Thanks.
You're probably looking for entity_save().

If you want to use a metadata wrapper for a custom entity properties you need to implement hook_entity_property_info() to describe them to the entity module, especially setter callbacks which are used to set the value of the property.