From 6eca8bd3a5c339a028c631770b1fc81d55b9eb33 Mon Sep 17 00:00:00 2001 From: Layla Manley Date: Sun, 8 Oct 2023 04:51:13 -0400 Subject: [PATCH] iteration --- lib/auth.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/auth.lua b/lib/auth.lua index ad3460a..9c4aeb9 100644 --- a/lib/auth.lua +++ b/lib/auth.lua @@ -49,6 +49,15 @@ function check_user_group(username, group) end end + +function list_to_string(list) + local str = "" + for i, v in ipairs(list) do + str = str .. v .. ", " + end + return str:sub(1, -3) +end + function list_user_groups(username) local data = { ["action"] = "list_groups", @@ -71,7 +80,7 @@ function list_user_groups(username) io.write("Invalid token\n") return else - return msg + return list_to_string(msg) end end end