From 0c4915da62a96bf6db20377ce11fa887b6271ad9 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 2 Apr 2016 23:35:15 -0400 Subject: Code cleanup. Do not use `ipairs()` and use more consistent variable names among other things. --- modules/textadept/command_entry.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/textadept/command_entry.lua') 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 -- cgit v1.2.3