From 0525f8898d3fa88d3bcf237c833ebd80de23b504 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 5 Nov 2008 10:52:02 +0100 Subject: [PATCH] widget: make name optional Signed-off-by: Julien Danjou --- widget.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/widget.c b/widget.c index 3d04da26a..ebfd8660c 100644 --- a/widget.c +++ b/widget.c @@ -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)