lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Jun 11, 2011 at 08:47:05AM +0200, PROXiCiDE wrote:
> Hi is there a way to minimize the repeat typing of such.. -MAP at the end?
> say...
>   
>   Normal Version
>       Type = {
>          Arabia = "ARABIA-MAP",
>          Archipelago = "ARCHIPELAGO-MAP",
>          Baltic = "BALTIC-MAP",
>          Coastal = "COASTAL-MAP",
>          Continental = "CONTINENTAL-MAP",
>          CraterLake = "CRATER-LAKE-MAP",
>          Fortress = "FORTRESS-MAP",
>          GoldRush = "GOLD-RUSH-MAP",
>          Highland = "HIGHLAND-MAP",
>          Islands = "ISLANDS-MAP",
>          Mediterranean = "MEDITERRANEAN-MAP",
>          Migration = "MIGRATION-MAP",
>          Rivers = "RIVERS-MAP",
>          TeamIslands = "TEAMISLANDS-MAP",
>          Scenario = "SCENARIO-MAP"
>       }
>   
>   Minimal Version?? If possible
>       Type = Map {
>          Arabia,
>          Archipelago,
>          ....so on and so on
>       }
> 
> 

names = "Arabia Archipelago Baltic Coastal Continental CraterLake Fortress GoldRush Highland Islands Mediterranean Migration Rivers TeamIslands Scenario"

Type={}

for k in string.gmatch(names,"%S+") do Type[k]=string.upper(k).."-MAP" end