local walmart = {search_query='walmart',title='Walmart',description='Walmart is a grocer which has groceries.'}
local WALMART = 'search_query=walmart*title=Walmart*description=Walmart is a grocer with groceries.'
local burgerKing = 'search_query=burger king*title=Burger King*description=Burger King is a fast food resteraunt with burger.'
local dataBase = {'search_query=number15*title=Foot Lettuce*description=The last thing you want on a burger king burger is lettuce with foot fungus.'}
table.insert(dataBase, WALMART) table.insert(dataBase, burgerKing)
function string.split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
function getResults(query)
for a,b in pairs(dataBase) do
local split = string.split(b, '*')
if string.lower(query) == string.sub(split[1],#'search_query='+1) then
local title = string.sub(split[2], #'title='+1)
local description = string.sub(split[3], #'description='+1)
print('Title: '..title)
print('Description: '..description)
end
end
end
getResults('walmart')
getResults('number15')
function hi(base1, base2, height)
local one = base1+base2
local two = one * height
local three = two/2
return three
end
print(hi(13, 8, 5))