From 1c73d3f87aba1b309ae1b577b5e70267394255c7 Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 29 Jul 2025 16:44:03 +0300 Subject: [PATCH] add examples of lua scripts --- com/Utils/Echo.lua | 8 ++++++++ com/Utils/Ping.lua | 1 + com/echo.lua | 13 ------------- 3 files changed, 9 insertions(+), 13 deletions(-) create mode 100644 com/Utils/Echo.lua create mode 100644 com/Utils/Ping.lua delete mode 100644 com/echo.lua diff --git a/com/Utils/Echo.lua b/com/Utils/Echo.lua new file mode 100644 index 0000000..77e438c --- /dev/null +++ b/com/Utils/Echo.lua @@ -0,0 +1,8 @@ +if not In.Params.msg or In.Params.msg == "" then + Out.Error = { + message = "there must be a msg parameter" + } + return +end + +Out.Result.answer = In.Params.msg \ No newline at end of file diff --git a/com/Utils/Ping.lua b/com/Utils/Ping.lua new file mode 100644 index 0000000..348ef2f --- /dev/null +++ b/com/Utils/Ping.lua @@ -0,0 +1 @@ +Out.Result.answer = "pong" \ No newline at end of file diff --git a/com/echo.lua b/com/echo.lua deleted file mode 100644 index 04603e6..0000000 --- a/com/echo.lua +++ /dev/null @@ -1,13 +0,0 @@ ---- #description = "Echoes back the message." ---- #args ---- msg = the message - -if not In.Params.msg or In.Params.msg == "" then - Out.Result.status = Status.error - Out.Result.error = "Missing parameter: msg" - return -end - -Out.Result.status = Status.ok -Out.Result.answer = In.Params.msg -return \ No newline at end of file