widget: make name optional

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-05 10:52:02 +01:00
parent 2d753ba228
commit 0525f8898d
1 changed files with 5 additions and 3 deletions

View File

@ -373,8 +373,7 @@ luaA_widget_new(lua_State *L)
buf = luaA_getopt_lstring(L, 2, "align", "left", &len);
align = draw_align_fromstr(buf, len);
if(!(buf = luaA_getopt_string(L, 2, "name", NULL)))
luaL_error(L, "object widget must have a name");
buf = luaA_getopt_string(L, 2, "name", NULL);
type = luaA_getopt_string(L, 2, "type", NULL);
@ -444,7 +443,10 @@ luaA_widget_index(lua_State *L)
lua_pushboolean(L, (*widget)->isvisible);
return 1;
case A_TK_NAME:
lua_pushstring(L, (*widget)->name);
if((*widget)->name)
lua_pushstring(L, (*widget)->name);
else
lua_pushnil(L);
return 1;
case A_TK_MOUSE_ENTER:
if((*widget)->mouse_enter != LUA_REFNIL)