basic Lua 5.4 implementation with few example commands
This commit is contained in:
parent
c9b9482cc8
commit
c4a774b5cf
35 changed files with 2554 additions and 460 deletions
13
resources/commands/counter/command.toml
Normal file
13
resources/commands/counter/command.toml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[[commands]]
|
||||
id = "counter"
|
||||
type = "lua"
|
||||
script = "script.lua"
|
||||
sandbox = "standard"
|
||||
timeout = 5000
|
||||
phrases.ru = [
|
||||
"счётчик"
|
||||
]
|
||||
phrases.en = [
|
||||
"counter",
|
||||
"count",
|
||||
]
|
||||
16
resources/commands/counter/script.lua
Normal file
16
resources/commands/counter/script.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
-- simple counter demonstrating state persistence
|
||||
|
||||
local count = jarvis.state.get("count") or 0
|
||||
count = count + 1
|
||||
jarvis.state.set("count", count)
|
||||
|
||||
local lang = jarvis.context.language
|
||||
local msg = lang == "ru"
|
||||
and "Счётчик: " .. count
|
||||
or "Counter: " .. count
|
||||
|
||||
jarvis.log("info", msg)
|
||||
jarvis.system.notify("Counter", tostring(count))
|
||||
jarvis.audio.play_ok()
|
||||
|
||||
return { chain = true }
|
||||
Loading…
Add table
Add a link
Reference in a new issue