From 9393b2d1110b308edddf3255b5a001fe64f49478 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 21 Sep 2009 20:35:14 +0200 Subject: [PATCH] screen: add index by output name (FS#361) Signed-off-by: Julien Danjou --- screen.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/screen.c b/screen.c index b7132157d..0333ed084 100644 --- a/screen.c +++ b/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]);