Possible bug: hero is not returned by map:get_entities("")
In the Lua API it says that the function map:get_entities("prefix") should return all map entities with the given prefix. But, if I am not wrong, the hero is not returned in the iterators map:get_entities("") or map:get_entities("hero"). Change the API (to say it does never return the hero), or allow the hero to be returned by map:get_entities("prefix") functions.