Debian Codegraph @

lua/extend/game.lua

raw symbols SCIP
1 --[[
2 Copyright (C) 2014 HarpyWar ([email protected])
3
4 This file is a part of the PvPGN Project http://pvpgn.pro
5 Licensed under the same terms as Lua itself.
6 ]]--
7
8
9 -- Get count of all games
10 function games_count()
11 local count = 0
12 for i,game in pairs(api.server_get_games()) do
13 count = count + 1
14 end
15 return count
16 end
17
18 function server_get_games(clienttag)
19 local gamelist = {}
20
21 for i,game in pairs(api.server_get_games()) do
22 if clienttag then
23 if (game.tag == clienttag) then
24 table.insert(gamelist, game)
25 end
26 else
27 table.insert(gamelist, game)
28 end
29 end
30 return gamelist
31 end