screen: add index by output name (FS#361)
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
c08b90345f
commit
9393b2d111
8
screen.c
8
screen.c
|
@ -442,6 +442,14 @@ luaA_pushscreen(lua_State *L, screen_t *s)
|
|||
static int
|
||||
luaA_screen_module_index(lua_State *L)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if((name = lua_tostring(L, 2)))
|
||||
foreach(screen, globalconf.screens)
|
||||
foreach(output, screen->outputs)
|
||||
if(!a_strcmp(output->name, name))
|
||||
return luaA_pushscreen(L, screen);
|
||||
|
||||
int screen = luaL_checknumber(L, 2) - 1;
|
||||
luaA_checkscreen(screen);
|
||||
return luaA_pushscreen(L, &globalconf.screens.tab[screen]);
|
||||
|
|
Loading…
Reference in New Issue