aboutsummaryrefslogtreecommitdiff
path: root/core/ext
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-12-23 14:43:10 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2008-12-23 14:43:10 -0500
commitcb6f0241890a0949acd6b38fe30cda061868ef26 (patch)
treea12ef44fc111947a43bc9fb31db331ed1ab77e0a /core/ext
parente21e536321fb74416be56dc600c337d434e52e6a (diff)
downloadtextadept-cb6f0241890a0949acd6b38fe30cda061868ef26.tar.gz
textadept-cb6f0241890a0949acd6b38fe30cda061868ef26.zip
Use table.concat instead of multiple string concats for performance improvement.
Diffstat (limited to 'core/ext')
-rw-r--r--core/ext/keys.lua8
1 files changed, 2 insertions, 6 deletions
diff --git a/core/ext/keys.lua b/core/ext/keys.lua
index 7ac2e0b1..99c0d143 100644
--- a/core/ext/keys.lua
+++ b/core/ext/keys.lua
@@ -217,13 +217,9 @@ end
-- of -1. This way, pcall will return false and -1, where the -1 can easily and
-- efficiently be checked rather than using a string error message.
try_get_cmd = function(active_table)
- local str_seq = ''
- for _, key_seq in ipairs(keychain) do
- str_seq = str_seq..key_seq..' '
- active_table = active_table[key_seq]
- end
+ for _, key_seq in ipairs(keychain) do active_table = active_table[key_seq] end
if #active_table == 0 and next(active_table) then
- textadept.statusbar_text = 'Keychain: '..str_seq
+ textadept.statusbar_text = 'Keychain: '..table.concat(keychain, ' ')
error(-1, 0)
else
local func = active_table[1]