[widget] Print error on unkown widget type
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
c822a9ccf1
commit
ab62a78884
4
widget.c
4
widget.c
|
@ -176,16 +176,14 @@ luaA_widget_new(lua_State *L)
|
||||||
|
|
||||||
type = luaA_getopt_string(L, 1, "type", NULL);
|
type = luaA_getopt_string(L, 1, "type", NULL);
|
||||||
|
|
||||||
/* \todo use type to call the widget_constructor_t and set ->tell*/
|
|
||||||
if((wc = name_func_lookup(type, WidgetList)))
|
if((wc = name_func_lookup(type, WidgetList)))
|
||||||
w = wc(align);
|
w = wc(align);
|
||||||
else
|
else
|
||||||
return 0;
|
luaL_error(L, "unkown widget type: %s", type);
|
||||||
|
|
||||||
/* Set visible by default. */
|
/* Set visible by default. */
|
||||||
w->isvisible = true;
|
w->isvisible = true;
|
||||||
|
|
||||||
/* \todo check that the name is unique */
|
|
||||||
w->name = luaA_name_init(L);
|
w->name = luaA_name_init(L);
|
||||||
|
|
||||||
return luaA_widget_userdata_new(w);
|
return luaA_widget_userdata_new(w);
|
||||||
|
|
Loading…
Reference in New Issue