lua: remove luaA_name_init
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
14061b4e7a
commit
f2d2a10d9b
7
lua.h
7
lua.h
|
@ -172,13 +172,6 @@ luaA_settype(lua_State *L, const char *type)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *
|
|
||||||
luaA_name_init(lua_State *L)
|
|
||||||
{
|
|
||||||
lua_getfield(L, 1, "name");
|
|
||||||
return a_strdup(luaL_checkstring(L, -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void luaA_init(void);
|
void luaA_init(void);
|
||||||
bool luaA_parserc(const char *);
|
bool luaA_parserc(const char *);
|
||||||
void luaA_pushpointer(lua_State *, void *, awesome_type_t);
|
void luaA_pushpointer(lua_State *, void *, awesome_type_t);
|
||||||
|
|
|
@ -540,9 +540,12 @@ luaA_statusbar_new(lua_State *L)
|
||||||
|
|
||||||
luaA_checktable(L, 1);
|
luaA_checktable(L, 1);
|
||||||
|
|
||||||
|
if(!(buf = luaA_getopt_string(L, 1, "name", NULL)))
|
||||||
|
luaL_error(L, "object statusbar must have a name");
|
||||||
|
|
||||||
sb = p_new(statusbar_t, 1);
|
sb = p_new(statusbar_t, 1);
|
||||||
|
|
||||||
sb->name = luaA_name_init(L);
|
sb->name = a_strdup(buf);
|
||||||
|
|
||||||
if(!(buf = luaA_getopt_string(L, 1, "fg", NULL))
|
if(!(buf = luaA_getopt_string(L, 1, "fg", NULL))
|
||||||
|| !xcolor_new(globalconf.connection, globalconf.default_screen,
|
|| !xcolor_new(globalconf.connection, globalconf.default_screen,
|
||||||
|
|
4
tag.c
4
tag.c
|
@ -316,7 +316,9 @@ luaA_tag_new(lua_State *L)
|
||||||
|
|
||||||
luaA_checktable(L, 1);
|
luaA_checktable(L, 1);
|
||||||
|
|
||||||
name = luaA_name_init(L);
|
if(!(name = luaA_getopt_string(L, 1, "name", NULL)))
|
||||||
|
luaL_error(L, "object tag must have a name");
|
||||||
|
|
||||||
mwfact = luaA_getopt_number(L, 1, "mwfact", 0.5);
|
mwfact = luaA_getopt_number(L, 1, "mwfact", 0.5);
|
||||||
ncol = luaA_getopt_number(L, 1, "ncol", 1);
|
ncol = luaA_getopt_number(L, 1, "ncol", 1);
|
||||||
nmaster = luaA_getopt_number(L, 1, "nmaster", 1);
|
nmaster = luaA_getopt_number(L, 1, "nmaster", 1);
|
||||||
|
|
6
widget.c
6
widget.c
|
@ -271,9 +271,13 @@ luaA_widget_new(lua_State *L)
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
luaA_checktable(L, 1);
|
luaA_checktable(L, 1);
|
||||||
|
|
||||||
buf = luaA_getopt_lstring(L, 1, "align", "left", &len);
|
buf = luaA_getopt_lstring(L, 1, "align", "left", &len);
|
||||||
align = draw_align_fromstr(buf, len);
|
align = draw_align_fromstr(buf, len);
|
||||||
|
|
||||||
|
if(!(buf = luaA_getopt_string(L, 1, "name", NULL)))
|
||||||
|
luaL_error(L, "object widget must have a name");
|
||||||
|
|
||||||
type = luaA_getopt_string(L, 1, "type", NULL);
|
type = luaA_getopt_string(L, 1, "type", NULL);
|
||||||
|
|
||||||
if((wc = name_func_lookup(type, WidgetList)))
|
if((wc = name_func_lookup(type, WidgetList)))
|
||||||
|
@ -286,7 +290,7 @@ luaA_widget_new(lua_State *L)
|
||||||
/* Set visible by default. */
|
/* Set visible by default. */
|
||||||
w->isvisible = true;
|
w->isvisible = true;
|
||||||
|
|
||||||
w->name = luaA_name_init(L);
|
w->name = a_strdup(buf);
|
||||||
|
|
||||||
return luaA_widget_userdata_new(L, w);
|
return luaA_widget_userdata_new(L, w);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue