MCPcopy Create free account
hub / github.com/DFHack/dfhack / do_input

Method do_input

library/modules/Screen.cpp:987–1015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985}
986
987int 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
1017dfhack_lua_viewscreen::dfhack_lua_viewscreen(lua_State *L, int table_idx)
1018{

Callers

nothing calls this directly

Calls 6

update_focusMethod · 0.95
lua_touserdataFunction · 0.85
lua_getfieldFunction · 0.85
lua_pushvalueFunction · 0.85
lua_tobooleanFunction · 0.85
countMethod · 0.45

Tested by

no test coverage detected