screen: Stop using a_tokenize()

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-09-02 18:53:44 +02:00
parent a440dab39d
commit 53ac35930d
1 changed files with 16 additions and 24 deletions

View File

@ -484,7 +484,6 @@ luaA_screen_tags(lua_State *L)
static int static int
luaA_screen_index(lua_State *L) luaA_screen_index(lua_State *L)
{ {
size_t len;
const char *buf; const char *buf;
screen_t *s; screen_t *s;
@ -503,37 +502,30 @@ luaA_screen_index(lua_State *L)
/* No, so remove everything. */ /* No, so remove everything. */
lua_pop(L, 2); lua_pop(L, 2);
buf = luaL_checklstring(L, 2, &len); buf = luaL_checkstring(L, 2);
s = lua_touserdata(L, 1); s = lua_touserdata(L, 1);
switch(a_tokenize(buf, len)) if(a_strcmp(buf, "index") == 0)
{
case A_TK_INDEX:
lua_pushinteger(L, screen_array_indexof(&globalconf.screens, s) + 1); lua_pushinteger(L, screen_array_indexof(&globalconf.screens, s) + 1);
break; else if(a_strcmp(buf, "geometry") == 0)
case A_TK_GEOMETRY:
luaA_pusharea(L, s->geometry); luaA_pusharea(L, s->geometry);
break; else if(a_strcmp(buf, "workarea") == 0)
case A_TK_WORKAREA:
luaA_pusharea(L, screen_area_get(s, true)); luaA_pusharea(L, screen_area_get(s, true));
break; else if(a_strcmp(buf, "outputs") == 0)
case A_TK_OUTPUTS: {
lua_createtable(L, 0, s->outputs.len);
foreach(output, s->outputs)
{ {
lua_createtable(L, 0, s->outputs.len); lua_createtable(L, 2, 0);
foreach(output, s->outputs) lua_pushinteger(L, output->mm_width);
{ lua_setfield(L, -2, "mm_width");
lua_createtable(L, 2, 0); lua_pushinteger(L, output->mm_height);
lua_pushinteger(L, output->mm_width); lua_setfield(L, -2, "mm_height");
lua_setfield(L, -2, "mm_width"); lua_setfield(L, -2, output->name);
lua_pushinteger(L, output->mm_height);
lua_setfield(L, -2, "mm_height");
lua_setfield(L, -2, output->name);
}
} }
break;
default:
return 0;
} }
else
return 0;
return 1; return 1;
} }