aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2013-12-18 00:08:31 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2013-12-18 00:08:31 -0500
commitb27c3bf193cb949c2173f39bbeb8a8f785c3d76f (patch)
treeb24450c57271c185e68611768404f465a95da4e4
parenta1cbcd780cf83b8a185f7d6439925c74974347d1 (diff)
Enable read-only access to the current chain of key sequences; core/keys.lua
-rw-r--r--core/keys.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/keys.lua b/core/keys.lua
index 5f168028..ae986f98 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -172,6 +172,17 @@ M.KEYSYMS = {
-- The current key sequence.
local keychain = {}
+---
+-- The current chain of key sequences. (Read-only.)
+-- Use the '#' operator (instead of `ipairs()`) for iteration.
+-- @class table
+-- @name keychain
+M.keychain = setmetatable({}, {
+ __index = keychain,
+ __newindex = function() error("'keys.keychain' is read-only") end,
+ __len = function() return #keychain end
+})
+
-- Clears the current key sequence.
local function clear_key_sequence()
-- Clearing a table is faster than re-creating one.