/usr/share/games/instead/stead/kbd.lua is in instead-data 1.9.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | game.action = stead.hook(game.action, function(f, s, cmd, ...)
if cmd == 'user_kbd' then
local r,v;
if stead.here().kbd then
r,v = stead.call(stead.here(), 'kbd',
input.key_event.down, input.key_event.key);
elseif s.kbd then
r,v = stead.call(s, 'kbd',
input.key_event.down, input.key_event.key);
end
if r == nil and v == nil and stead.api_version < "1.3.5" then
return nil, true
end
return r,v
end
return f(s, cmd, ...);
end)
stead.module_init(function()
input.key = stead.hook(input.key, function(f, s, down, key, ...)
if input._key_hooks[key] then
input.key_event = { key = key, down = down };
return 'user_kbd'
end
return f(s, down, key, ...)
end)
input._key_hooks = {}
end)
stead.hook_keys = function(...)
local i
local a = {...};
for i = 1, stead.table.maxn(a) do
input._key_hooks[tostring(a[i])] = true;
end
end
stead.unhook_keys = function(...)
local i
local a = {...};
for i = 1, stead.table.maxn(a) do
input._key_hooks[tostring(a[i])] = nil;
end
end
hook_keys = stead.hook_keys
unhook_keys = stead.unhook_keys
-- vim:ts=4
|