Set c.screen in ewmh.tag and before tags in rules.execute
[awesome.git] / common / lualib.c
bloba53aa5cab6ad08d4a29c8428b6b239e39695f555
1 /*
2 * lualib.h - useful functions and type for Lua
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 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 General Public License for more details.
14 * You should have received a copy of the GNU 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 #include "luaa.h"
22 void luaA_checkfunction(lua_State *L, int idx)
24 if(!lua_isfunction(L, idx))
25 luaA_typerror(L, idx, "function");
28 void luaA_checktable(lua_State *L, int idx)
30 if(!lua_istable(L, idx))
31 luaA_typerror(L, idx, "table");
34 void luaA_dumpstack(lua_State *L)
36 fprintf(stderr, "-------- Lua stack dump ---------\n");
37 for(int i = lua_gettop(L); i; i--)
39 int t = lua_type(L, i);
40 switch (t)
42 case LUA_TSTRING:
43 fprintf(stderr, "%d: string: `%s'\n", i, lua_tostring(L, i));
44 break;
45 case LUA_TBOOLEAN:
46 fprintf(stderr, "%d: bool: %s\n", i, lua_toboolean(L, i) ? "true" : "false");
47 break;
48 case LUA_TNUMBER:
49 fprintf(stderr, "%d: number: %g\n", i, lua_tonumber(L, i));
50 break;
51 case LUA_TNIL:
52 fprintf(stderr, "%d: nil\n", i);
53 break;
54 default:
55 fprintf(stderr, "%d: %s\t#%d\t%p\n", i, lua_typename(L, t),
56 (int) luaA_rawlen(L, i),
57 lua_topointer(L, i));
58 break;
61 fprintf(stderr, "------- Lua stack dump end ------\n");