aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/command_entry.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-04-02 23:35:15 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-04-02 23:35:15 -0400
commit0c4915da62a96bf6db20377ce11fa887b6271ad9 (patch)
tree4bc7d4b0722bce49aebf341841f3ab4fa8ad1dfd /modules/textadept/command_entry.lua
parentf6705b546d2f037302f2d2d95bae507e78b29d59 (diff)
downloadtextadept-0c4915da62a96bf6db20377ce11fa887b6271ad9.tar.gz
textadept-0c4915da62a96bf6db20377ce11fa887b6271ad9.zip
Code cleanup.
Do not use `ipairs()` and use more consistent variable names among other things.
Diffstat (limited to 'modules/textadept/command_entry.lua')
-rw-r--r--modules/textadept/command_entry.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 6c7a4359..325db3cb 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -115,9 +115,9 @@ local env = setmetatable({}, {
return f
end,
__newindex = function(t, k, v)
- for _, t2 in ipairs{buffer, view, ui} do
- if t2[k] ~= nil then t2[k] = v return end
- end
+ if buffer[k] ~= nil then buffer[k] = v return end
+ if view[k] ~= nil then view[k] = v return end
+ if ui[k] ~= nil then ui[k] = v return end
rawset(t, k, v)
end,
})
@@ -143,9 +143,9 @@ local function complete_lua()
local line, pos = M:get_cur_line()
local symbol, op, part = line:sub(1, pos):match('([%w_.]-)([%.:]?)([%w_]*)$')
local ok, result = pcall((load('return ('..symbol..')', nil, 'bt', env)))
+ if (not ok or type(result) ~= 'table') and symbol ~= '' then return end
local cmpls = {}
part = '^'..part
- if (not ok or type(result) ~= 'table') and symbol ~= '' then return end
if not ok then -- shorthand notation
local pool = {
buffer, view, ui, _G, _SCINTILLA.functions, _SCINTILLA.properties