diff options
author | Alexander Weber <web.alexander@web.de> | 2018-02-15 06:54:12 +0100 |
---|---|---|
committer | sofar <sofar+github@foo-projects.org> | 2018-02-19 11:18:18 -0800 |
commit | e619bc8d83746eabf1105adebbbab1b65c080318 (patch) | |
tree | 7e9c1aaecccd186c30771c55cd846771b90ea8ec /chatcommands.lua | |
parent | 14288a1ff093f5de89660350cb222003e021350d (diff) |
Adjustments based on SmallJoker feedback
Diffstat (limited to 'chatcommands.lua')
-rw-r--r-- | chatcommands.lua | 35 |
1 files 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 |