Move calenadar search script to communty folder

This commit is contained in:
Evgeny
2023-03-15 09:26:11 +04:00
parent cadc5aace7
commit d176696fc9

View File

@@ -0,0 +1,25 @@
-- name = "Calendar"
-- description = "Calendar search script"
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
-- type = "search"
local events = calendar:events()
local results = {}
function on_search(str)
results = {}
buttons = {}
for _,event in pairs(events) do
if event.title:lower():find(str:lower()) ~= nil then
table.insert(results, event)
table.insert(buttons, event.title)
end
end
search:show(buttons)
end
function on_click(idx)
calendar:open_event(results[idx].id)
end