2 --Copyright (C) 2013 sapier
4 --This program is free software; you can redistribute it and/or modify
5 --it under the terms of the GNU Lesser General Public License as published by
6 --the Free Software Foundation; either version 2.1 of the License, or
7 --(at your option) any later version.
9 --This program is distributed in the hope that it will be useful,
10 --but WITHOUT ANY WARRANTY; without even the implied warranty of
11 --MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 --GNU Lesser General Public License for more details.
14 --You should have received a copy of the GNU Lesser General Public License along
15 --with this program; if not, write to the Free Software Foundation, Inc.,
16 --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 --------------------------------------------------------------------------------
21 function gamemgr.find_by_gameid(gameid)
22 for i=1,#gamemgr.games,1 do
23 if gamemgr.games[i].id == gameid then
24 return gamemgr.games[i], i
30 --------------------------------------------------------------------------------
31 function gamemgr.get_game_mods(gamespec, retval)
32 if gamespec ~= nil and
33 gamespec.gamemods_path ~= nil and
34 gamespec.gamemods_path ~= "" then
35 get_mods(gamespec.gamemods_path, retval)
39 --------------------------------------------------------------------------------
40 function gamemgr.get_game_modlist(gamespec)
43 gamemgr.get_game_mods(gamespec, game_mods)
44 for i=1,#game_mods,1 do
48 retval = retval .. game_mods[i].name
53 --------------------------------------------------------------------------------
54 function gamemgr.get_game(index)
55 if index > 0 and index <= #gamemgr.games then
56 return gamemgr.games[index]
62 --------------------------------------------------------------------------------
63 function gamemgr.update_gamelist()
64 gamemgr.games = core.get_games()
67 --------------------------------------------------------------------------------
68 function gamemgr.gamelist()
70 if #gamemgr.games > 0 then
71 retval = retval .. gamemgr.games[1].name
73 for i=2,#gamemgr.games,1 do
74 retval = retval .. "," .. gamemgr.games[i].name
80 --------------------------------------------------------------------------------
82 --------------------------------------------------------------------------------
83 gamemgr.update_gamelist()