2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (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 General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 #include "_quvi_script_s.h"
30 #include "lua/chk_accepts.h"
31 #include "lua/getfield.h"
33 gboolean
l_chk_accepts(lua_State
*l
, _quvi_script_t qs
,
34 const gchar
*k_accepts
, const gchar
*k_domains
,
35 const gchar
*script_func
)
39 lua_pushstring(l
, k_accepts
);
42 if (lua_istable(l
, -1))
44 const gchar
*s
= l_getfield_s(l
, k_domains
,
45 qs
->fpath
->str
, script_func
);
47 g_string_assign(qs
->domains
, s
);
49 r
= l_getfield_b(l
, k_accepts
, qs
->fpath
->str
, script_func
);
53 luaL_error(l
, "%s: %s: expected to return a table containing table `%s'",
54 qs
->fpath
->str
, script_func
, k_accepts
);
61 /* vim: set ts=2 sw=2 tw=72 expandtab: */