diff options
author | cracyc <cracyc@users.noreply.github.com> | 2016-05-03 09:39:16 -0500 |
---|---|---|
committer | cracyc <cracyc@users.noreply.github.com> | 2016-05-03 09:39:16 -0500 |
commit | 295774fabbd4eae7e1e5224cd690116ed9589e6d (patch) | |
tree | 186ce13886f705838217060a8d3a16b32585af48 | |
parent | 37898321e24721d55c908cd8f04a087c20a14524 (diff) |
plugins/cheatfind: more (nw)
-rw-r--r-- | plugins/cheatfind/init.lua | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua index 378b023ed4f..cce26177cfb 100644 --- a/plugins/cheatfind/init.lua +++ b/plugins/cheatfind/init.lua @@ -476,20 +476,17 @@ function cheatfind.startplugin() end return m, function(event) local r bcd, r = incdec(event, bcd, 0, 1) return r end end - menu[#menu + 1] = function() - if #matches == 0 then - return nil - end - local function f(event) - if event == "select" and #matches > 0 then - matches[#matches] = nil - matchpg = 0 - return true + if #matches ~= 0 then + menu[#menu + 1] = function() + local function f(event) + if event == "select" then + matches[#matches] = nil + matchpg = 0 + return true + end end + return { "Undo last search -- #" .. #matches, "", 0 }, f end - return { "Undo last search -- #" .. #matches, "", 0 }, f - end - if #matches ~= 0 then menu[#menu + 1] = function() return { "---", "", "off" }, nil end menu[#menu + 1] = function() local m = { "Match block", matchsel, "" } @@ -632,22 +629,22 @@ function cheatfind.startplugin() return m, f end end - end - if #matches > 0 and matches[#matches].count > 100 then - menu[#menu + 1] = function() - local m = { "Page", matchpg, 0 } - local max - if matchsel == 0 then - max = math.ceil(matches[#matches].count / 100) - else - max = #matches[#matches][matchsel] - end - menu_lim(matchpg, 0, max, m) - local function f(event) - matchpg, r = incdec(event, matchpg, 0, max) - return r + if matches[#matches].count > 100 then + menu[#menu + 1] = function() + local m = { "Page", matchpg, 0 } + local max + if matchsel == 0 then + max = math.ceil(matches[#matches].count / 100) + else + max = #matches[#matches][matchsel] + end + menu_lim(matchpg, 0, max, m) + local function f(event) + matchpg, r = incdec(event, matchpg, 0, max) + return r + end + return m, f end - return m, f end end if #watches ~= 0 then |