blob: d74095bddf529d0c1da827dbe76446eef0821188 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-- A trivial Lua slash command that greets the user.
-- Drop this under .panto/extensions/ (project) or your user config's
-- extensions/ dir, then type `/greet` or `/greet <name>` in the REPL.
--
-- Slash-command handlers run synchronously and act by side effect (here,
-- writing to stdout). `args` is the trimmed text after the command name;
-- it is an empty string when none was given. The return value is ignored.
local panto = require("panto")
panto.ext.register_command {
name = "greet",
description = "Print a greeting. Optional args name who to greet.",
handler = function(args)
local who = args ~= "" and args or "world"
io.write("\n[greet] hello, " .. who .. "!\n")
end,
}
|