basic Lua 5.4 implementation with few example commands

This commit is contained in:
Priler 2026-01-17 05:46:38 +05:00
parent c9b9482cc8
commit c4a774b5cf
35 changed files with 2554 additions and 460 deletions

View file

@ -0,0 +1,32 @@
-- set city for weather command
local phrase = jarvis.context.phrase
local lang = jarvis.context.language
-- try to extract city name from phrase
-- this is a simple example - you might want better parsing
local city = phrase:match("город%s+(.+)") or phrase:match("city%s+(.+)")
if city then
city = city:gsub("^%s*(.-)%s*$", "%1") -- trim
-- save to state (shared with weather command)
jarvis.state.set("city", city)
local msg = lang == "ru"
and "Город установлен: " .. city
or "City set to: " .. city
jarvis.log("info", msg)
jarvis.system.notify("Jarvis", msg)
jarvis.audio.play_ok()
else
local msg = lang == "ru"
and "Не удалось определить город"
or "Could not determine city"
jarvis.log("warn", msg)
jarvis.audio.play_not_found()
end
return { chain = false }