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

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

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
  return NIL

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:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to