| 985 | } |
| 986 | |
| 987 | int dfhack_lua_viewscreen::do_input(lua_State *L) |
| 988 | { |
| 989 | auto self = get_self(L); |
| 990 | if (!self) return 0; |
| 991 | |
| 992 | auto keys = (std::set<df::interface_key>*)lua_touserdata(L, 2); |
| 993 | if (!keys) return 0; |
| 994 | |
| 995 | lua_getfield(L, -1, "onInput"); |
| 996 | |
| 997 | if (lua_isnil(L, -1)) |
| 998 | { |
| 999 | if (keys->count(interface_key::LEAVESCREEN)) |
| 1000 | Screen::dismiss(self); |
| 1001 | |
| 1002 | return 0; |
| 1003 | } |
| 1004 | |
| 1005 | lua_pushvalue(L, -2); |
| 1006 | Lua::PushInterfaceKeys(L, Screen::normalize_text_keys(*keys)); |
| 1007 | |
| 1008 | lua_call(L, 2, 1); |
| 1009 | if (lua_toboolean(L, -1)) |
| 1010 | markInputAsHandled(); |
| 1011 | lua_pop(L, 1); |
| 1012 | |
| 1013 | self->update_focus(L, -1); |
| 1014 | return 0; |
| 1015 | } |
| 1016 | |
| 1017 | dfhack_lua_viewscreen::dfhack_lua_viewscreen(lua_State *L, int table_idx) |
| 1018 | { |
nothing calls this directly
no test coverage detected