| 33 | } |
| 34 | |
| 35 | int AppUI::remove(lua_State *L) |
| 36 | { |
| 37 | KApp *app = KApp::getApp(L); |
| 38 | if (!app || lua_gettop(L) < 1) return 0; |
| 39 | AppWidget *w = nullptr; |
| 40 | if (lua_type(L, 1) == LUA_TSTRING) |
| 41 | { |
| 42 | w = app->getWidget(lua_tostring(L, 1)); |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | w = AppWidget::checkWidget(L, 1, AppWidget::MetaName); |
| 47 | if (w) |
| 48 | { |
| 49 | lua_pushnil(L); |
| 50 | lua_setmetatable(L, 1); // widget meta |
| 51 | } |
| 52 | } |
| 53 | if (w) |
| 54 | { |
| 55 | w->deleteLater(); |
| 56 | } |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | } |
no test coverage detected