aboutsummaryrefslogtreecommitdiff
path: root/core/events.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-03-17 17:41:02 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-03-17 17:41:02 -0400
commita1179904c022d6ccd22ebd00a4db2618a9d9ca34 (patch)
tree825bae061b80facf01a5fbf921e9120042c4211c /core/events.lua
parent8f061a7148266ce8d4a05459f7de680a47b8899e (diff)
downloadtextadept-a1179904c022d6ccd22ebd00a4db2618a9d9ca34.tar.gz
textadept-a1179904c022d6ccd22ebd00a4db2618a9d9ca34.zip
Performance and speed improvements.
Diffstat (limited to 'core/events.lua')
-rw-r--r--core/events.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/events.lua b/core/events.lua
index 19b556b1..b723e9f0 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -162,8 +162,9 @@ local error_emitted = false
function emit(event, ...)
local h = handlers[event]
if not h then return end
- for _, f in ipairs(h) do
- local ok, result = pcall(f, unpack{...})
+ local pcall, unpack, type = _G.pcall, _G.unpack, _G.type
+ for i = 1, #h do
+ local ok, result = pcall(h[i], unpack{...})
if not ok then
if not error_emitted then
error_emitted = true
@@ -199,7 +200,7 @@ local scnnotifications = {
function notification(n)
local f = scnnotifications[n.code]
if not f then return end
- local args = { unpack(f, 2) }
- for i, v in ipairs(args) do args[i] = n[v] end
+ local args = {}
+ for i = 2, #f do args[i - 1] = n[f[i]] end
return emit(f[1], unpack(args))
end