From e619bc8d83746eabf1105adebbbab1b65c080318 Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Thu, 15 Feb 2018 06:54:12 +0100 Subject: [PATCH] Adjustments based on SmallJoker feedback --- chatcommands.lua | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/chatcommands.lua b/chatcommands.lua index 841145d..debcd04 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -19,26 +19,18 @@ minetest.register_chatcommand("skinsdb", { -- parse command line local command, parameter - for word in param:gmatch("([^ ]+)") do - if not command then - -- first word - if word == 'set' or word == 'list' or word == 'show' or word == 'ui' then - command = word - elseif skins.get(word) then - command = 'set' - parameter = word - break - else - return false, "unknown command "..word.." see /help skinsdb for supported parameters" - end - else - -- second word - parameter = word - break - end - end - if not command then - command = "ui" + local words = param:split(" ") + local word = words[1] + if word == 'set' or word == 'list' or word == 'show' or word == 'ui' then + command = word + parameter = words[2] + elseif skins.get(word) then + command = 'set' + parameter = word + elseif not word then + command = 'ui' + else + return false, "unknown command "..word.." see /help skinsdb for supported parameters" end if command == "set" then @@ -62,7 +54,8 @@ minetest.register_chatcommand("skinsdb", { local current_skin_key = skins.get_player_skin(player):get_key() for _, skin in ipairs(list) do - local info = skin:get_key()..": name="..skin:get_meta_string("name").." author="..skin:get_meta_string("author").." license="..skin:get_meta_string("license") + local info = skin:get_key()..": name="..skin:get_meta_string("name").." author=" + ..skin:get_meta_string("author").." license="..skin:get_meta_string("license") if skin:get_key() == current_skin_key then info = minetest.colorize("#00FFFF", info) end