Chat commands: Trim whitespaces from input of `/privs` command
authorred-001 <red-001@openmailbox.org>
Mon, 26 Sep 2016 18:07:52 +0000 (19:07 +0100)
committerparamat <mat.gregory@virginmedia.com>
Thu, 20 Oct 2016 02:39:03 +0000 (03:39 +0100)
builtin/game/chatcommands.lua

index d8fee1578757926f327bf71877d5644ade3b7d8a..2bd93855bda4ffeb881c443a94bd5a12882da3be 100644 (file)
@@ -147,11 +147,12 @@ core.register_chatcommand("help", {
 core.register_chatcommand("privs", {
        params = "<name>",
        description = "print out privileges of player",
-       func = function(name, param)
-               param = (param ~= "" and param or name)
-               return true, "Privileges of " .. param .. ": "
+       func = function(caller, param)
+               param = param:trim()
+               local name = (param ~= "" and param or caller)
+               return true, "Privileges of " .. name .. ": "
                        .. core.privs_to_string(
-                               core.get_player_privs(param), ' ')
+                               core.get_player_privs(name), ' ')
        end,
 })