]> git.lizzy.rs Git - minetest.git/commitdiff
Message for empty list output in /haspriv & /mods (#11149)
authorWuzzy <wuzzy2@mail.ru>
Sat, 12 Jun 2021 16:48:21 +0000 (16:48 +0000)
committerGitHub <noreply@github.com>
Sat, 12 Jun 2021 16:48:21 +0000 (18:48 +0200)
builtin/game/chat.lua

index e155fba7035214094cc20a9fe91e76170861eca3..354b0ff908c850584de10a35da6be61e1f34429b 100644 (file)
@@ -212,9 +212,14 @@ core.register_chatcommand("haspriv", {
                                table.insert(players_with_priv, player_name)
                        end
                end
-               return true, S("Players online with the \"@1\" privilege: @2",
-                               param,
-                               table.concat(players_with_priv, ", "))
+               if #players_with_priv == 0 then
+                       return true, S("No online player has the \"@1\" privilege.",
+                                       param)
+               else
+                       return true, S("Players online with the \"@1\" privilege: @2",
+                                       param,
+                                       table.concat(players_with_priv, ", "))
+               end
        end
 })
 
@@ -737,7 +742,12 @@ core.register_chatcommand("mods", {
        description = S("List mods installed on the server"),
        privs = {},
        func = function(name, param)
-               return true, table.concat(core.get_modnames(), ", ")
+               local mods = core.get_modnames()
+               if #mods == 0 then
+                       return true, S("No mods installed.")
+               else
+                       return true, table.concat(core.get_modnames(), ", ")
+               end
        end,
 })