[tag] Add lua function to get/set tag's name.
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
981b26cbc8
commit
2c548ef816
20
tag.c
20
tag.c
|
@ -411,6 +411,24 @@ luaA_tag_nmaster_get(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_tag_name_get(lua_State *L)
|
||||
{
|
||||
tag_t **tag = luaL_checkudata(L, 1, "tag");
|
||||
lua_pushstring(L, (*tag)->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_tag_name_set(lua_State *L)
|
||||
{
|
||||
tag_t **tag = luaL_checkudata(L, 1, "tag");
|
||||
const char *name = luaL_checkstring(L, 2);
|
||||
p_delete(&(*tag)->name);
|
||||
(*tag)->name = a_strdup(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_tag_gc(lua_State *L)
|
||||
{
|
||||
|
@ -436,6 +454,8 @@ const struct luaL_reg awesome_tag_meta[] =
|
|||
{ "ncol_get", luaA_tag_ncol_get },
|
||||
{ "nmaster_set", luaA_tag_nmaster_set },
|
||||
{ "nmaster_get", luaA_tag_nmaster_get },
|
||||
{ "name_get", luaA_tag_name_get },
|
||||
{ "name_set", luaA_tag_name_set },
|
||||
{ "__eq", luaA_tag_eq },
|
||||
{ "__gc", luaA_tag_gc },
|
||||
{ "__tostring", luaA_tag_tostring },
|
||||
|
|
Loading…
Reference in New Issue