widget: make name optional
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
2d753ba228
commit
0525f8898d
8
widget.c
8
widget.c
|
@ -373,8 +373,7 @@ luaA_widget_new(lua_State *L)
|
||||||
buf = luaA_getopt_lstring(L, 2, "align", "left", &len);
|
buf = luaA_getopt_lstring(L, 2, "align", "left", &len);
|
||||||
align = draw_align_fromstr(buf, len);
|
align = draw_align_fromstr(buf, len);
|
||||||
|
|
||||||
if(!(buf = luaA_getopt_string(L, 2, "name", NULL)))
|
buf = luaA_getopt_string(L, 2, "name", NULL);
|
||||||
luaL_error(L, "object widget must have a name");
|
|
||||||
|
|
||||||
type = luaA_getopt_string(L, 2, "type", NULL);
|
type = luaA_getopt_string(L, 2, "type", NULL);
|
||||||
|
|
||||||
|
@ -444,7 +443,10 @@ luaA_widget_index(lua_State *L)
|
||||||
lua_pushboolean(L, (*widget)->isvisible);
|
lua_pushboolean(L, (*widget)->isvisible);
|
||||||
return 1;
|
return 1;
|
||||||
case A_TK_NAME:
|
case A_TK_NAME:
|
||||||
lua_pushstring(L, (*widget)->name);
|
if((*widget)->name)
|
||||||
|
lua_pushstring(L, (*widget)->name);
|
||||||
|
else
|
||||||
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
case A_TK_MOUSE_ENTER:
|
case A_TK_MOUSE_ENTER:
|
||||||
if((*widget)->mouse_enter != LUA_REFNIL)
|
if((*widget)->mouse_enter != LUA_REFNIL)
|
||||||
|
|
Loading…
Reference in New Issue