added a way to edit, remove, and add words

This commit is contained in:
UndeadMaelys
2022-03-24 21:47:24 +01:00
parent 39335c7e09
commit 93da415c03
9 changed files with 396 additions and 177 deletions

View File

@@ -1,7 +1,7 @@
return function(query)
function searchList(query)
results_table = {}
local skip_regular = false
for _, v in pairs(arg) do
for _, v in pairs(arg) do
if v == "-i" or v == "--id" then
skip_regular = true
local id = tonumber(query)
@@ -9,40 +9,40 @@ return function(query)
local word = {id,words[id]}
table.insert(results_table,word)
end
break
break
end
end
for i=1, #words do
if skip_regular then break end
local exit = true
local all = true
for _, v in pairs(arg) do
for _, v in pairs(arg) do
if v == "-r" or v == "--raw" then
all = false
word = string.gsub(words[i][1],"%p","")
if string.find(word, query) then
word = string.gsub(words[i][1],"%p","")
if string.find(word, query) then
exit = false
break
end
break
end
end
if v == "-e" or v == "--english" then
all = false
word = string.gsub(words[i][2],"%p","")
if string.find(word, query) then
word = string.gsub(words[i][2],"%p","")
if string.find(word, query) then
exit = false
break
end
break
end
end
end
if all == true then
for j=1, #words[i]-1 do
word = string.gsub(words[i][j],"%p","")
if string.find(word, query) then
for j=1, #words[i] do
word = string.gsub(words[i][j],"%p","")
if string.find(word, query) then
exit = false
break
break
end
end
end
end
if not exit then
local word = {i,words[i]}
table.insert(results_table,word)
@@ -58,4 +58,4 @@ return function(query)
print("no words found for query <" .. query .. ">")
end
end
end
end