From: red-001 Date: Mon, 26 Sep 2016 18:07:52 +0000 (+0100) Subject: Chat commands: Trim whitespaces from input of `/privs` command X-Git-Tag: 0.4.15~165 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c7d569b8636d8046393715e46fca40e58138183f;p=oweals%2Fminetest.git Chat commands: Trim whitespaces from input of `/privs` command --- diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index d8fee1578..2bd93855b 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -147,11 +147,12 @@ core.register_chatcommand("help", { core.register_chatcommand("privs", { params = "", 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, })