sm00thslp / hedgewars

Automatically exported from code.google.com/p/hedgewars
GNU General Public License v2.0
0 stars 0 forks source link

Add more team/clan query functions into the Lua API #830

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a feature request.

It would make using the Lua API much less a pain in the ass if there are some 
helper functions regarding team and clan query functions.

GetTeamNames()
Returns a table of team names of currently existing teams. This table (and the 
other tables I propose) should use the “standard format”, which is goes 
like this:
{[1]="Team", [2]="Another Team", [3]="Great Team" --[[ and so on]] }

This function will be useful for loops and stuff.

GetTeamClan(teamName)
- teamName: a name of a team
Returns the clan ID of the clan to which the team belongs to.

GetClanTeamNames(clanID)
- clanID: The ID of a clan
Returns a table containing the names of all (currently existing) teams 
belonging to this clan.

I am not sure if the following functions are really needed, but they may become 
handy in future (feel free to ignore them if you don’t think they are 
neccessary):
GetTeamIdByName(teamName)
- teamName: a name of a team
Returns the internal ID of the given team

GetTeamNameById(teamID)
- teamID: an ID of a team
Returns the name of the given team.

Theoretically, most of this information can be obtained by an ugly workaround 
which involves using trackers. Implementing this is not urgent. But it would 
make for much cleaner and easier code if the team names can be queried directly.

Original issue reported on code.google.com by almikes@aol.com on 23 Nov 2014 at 8:07

GoogleCodeExporter commented 9 years ago

Original comment by sheepyluva on 27 Nov 2014 at 8:20