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;
|
||||
}
|
||||
|
||||
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);
|
||||
bool luaA_parserc(const char *);
|
||||
void luaA_pushpointer(lua_State *, void *, awesome_type_t);
|
||||
|
|
|
@ -540,10 +540,13 @@ luaA_statusbar_new(lua_State *L)
|
|||
|
||||
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->name = luaA_name_init(L);
|
||||
|
||||
sb->name = a_strdup(buf);
|
||||
|
||||
if(!(buf = luaA_getopt_string(L, 1, "fg", NULL))
|
||||
|| !xcolor_new(globalconf.connection, globalconf.default_screen,
|
||||
buf, &sb->colors.fg))
|
||||
|
|
4
tag.c
4
tag.c
|
@ -316,7 +316,9 @@ luaA_tag_new(lua_State *L)
|
|||
|
||||
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);
|
||||
ncol = luaA_getopt_number(L, 1, "ncol", 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;
|
||||
|
||||
luaA_checktable(L, 1);
|
||||
|
||||
buf = luaA_getopt_lstring(L, 1, "align", "left", &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);
|
||||
|
||||
if((wc = name_func_lookup(type, WidgetList)))
|
||||
|
@ -286,7 +290,7 @@ luaA_widget_new(lua_State *L)
|
|||
/* Set visible by default. */
|
||||
w->isvisible = true;
|
||||
|
||||
w->name = luaA_name_init(L);
|
||||
w->name = a_strdup(buf);
|
||||
|
||||
return luaA_widget_userdata_new(L, w);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue