Follow-up Comment #5, patch #3495 (project freeciv):

It should even work using lua. Below an (untested) function:

[code]
function search_player_with_nation(nation_str)
  for player in players_iterate() do
    local plr_nation_str = player.nation:rule_name()
    if (nation_str == plr_nation_str)
      return player
    end
  end
  
  return NIL
end
[/code]

It returns with player with nation 'nation_str' if it exists, else NIL. The
player can then be used in the functions to create the city, etc.

Question: should such functions be collected in something like a lua (example)
library? I think such functions helps to learn lua and are perhaps rewritten
as their existence is not known. It could be default.lua in the ruleset
directories or functions.lua in ./data. I know about function usefull for
longturn to create new players which were posted here long ago

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?3495>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to