| 136 | static bool inhibit_m = false; |
| 137 | |
| 138 | void DFHack::Lua::PushInterfaceKeys(lua_State *L, |
| 139 | const std::set<df::interface_key> &keys) { |
| 140 | lua_createtable(L, 0, keys.size() + 7); |
| 141 | |
| 142 | for (auto &key : keys) |
| 143 | { |
| 144 | if (auto name = enum_item_raw_key(key)) |
| 145 | lua_pushstring(L, name); |
| 146 | else |
| 147 | lua_pushinteger(L, key); |
| 148 | |
| 149 | lua_pushboolean(L, true); |
| 150 | lua_rawset(L, -3); |
| 151 | |
| 152 | int charval = Screen::keyToChar(key); |
| 153 | if (charval >= 0) |
| 154 | { |
| 155 | lua_pushinteger(L, charval); |
| 156 | lua_setfield(L, -2, "_STRING"); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | if (df::global::enabler) { |
| 161 | if (!inhibit_l && df::global::enabler->mouse_lbut) { |
| 162 | lua_pushboolean(L, true); |
| 163 | lua_setfield(L, -2, "_MOUSE_L"); |
| 164 | trigger_inhibit_l = true; |
| 165 | } |
| 166 | if (!inhibit_r && df::global::enabler->mouse_rbut) { |
| 167 | lua_pushboolean(L, true); |
| 168 | lua_setfield(L, -2, "_MOUSE_R"); |
| 169 | trigger_inhibit_r = true; |
| 170 | } |
| 171 | if (!inhibit_m && df::global::enabler->mouse_mbut) { |
| 172 | lua_pushboolean(L, true); |
| 173 | lua_setfield(L, -2, "_MOUSE_M"); |
| 174 | trigger_inhibit_m = true; |
| 175 | } |
| 176 | if (df::global::enabler->mouse_lbut_down) { |
| 177 | lua_pushboolean(L, true); |
| 178 | lua_setfield(L, -2, "_MOUSE_L_DOWN"); |
| 179 | } |
| 180 | if (df::global::enabler->mouse_rbut_down) { |
| 181 | lua_pushboolean(L, true); |
| 182 | lua_setfield(L, -2, "_MOUSE_R_DOWN"); |
| 183 | } |
| 184 | if (df::global::enabler->mouse_mbut_down) { |
| 185 | lua_pushboolean(L, true); |
| 186 | lua_setfield(L, -2, "_MOUSE_M_DOWN"); |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | int DFHack::Lua::PushPosXYZ(lua_State *state, const df::coord &pos) |
| 192 | { |
nothing calls this directly
no test coverage detected