-- 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 ` in the REPL. -- -- Extensions return an *entry* `{ name, activate }`. The file is always -- eval'd, but `activate()` runs only if `name` is permitted by the -- `[extensions]` policy — so registration is deferred into activate(). -- One entry may register any number of tools/commands. -- -- 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") return { name = "greet", activate = function() 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, } end, }