[CSM] Move `.list_players` and `.disconnect` to builtin. (#5550)
authorred-001 <red-001@outlook.ie>
Mon, 10 Apr 2017 19:13:20 +0000 (20:13 +0100)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Mon, 10 Apr 2017 19:13:20 +0000 (21:13 +0200)
builtin/client/chatcommands.lua
clientmods/preview/init.lua

index 7a1b4b6b71851ff2d38a5b288fd0f4e4dccc1472..bb5b905d89bd440815de61ec87f55305d82986a7 100644 (file)
@@ -34,3 +34,18 @@ core.register_on_sending_chat_messages(function(message)
 
        return true
 end)
+
+core.register_chatcommand("list_players", {
+       description = "List online players",
+       func = function(param)
+               local players = table.concat(core.get_player_names(), ", ")
+               core.display_chat_message("Online players: " .. players)
+       end
+})
+
+core.register_chatcommand("disconnect", {
+       description = "Exit to main menu",
+       func = function(param)
+               core.disconnect()
+       end,
+})
index 5c0628bfe8a08a694cdb29786f9ef57abc5caba0..df07f8c3fe81c550a2a16062d5e7f8e1f1e5fd6d 100644 (file)
@@ -126,16 +126,3 @@ core.register_on_punchnode(function(pos, node)
        return false
 end)
 
--- This is an example function to ensure it's working properly, should be removed before merge
-core.register_chatcommand("list_players", {
-       func = function(param)
-               core.display_chat_message(dump(core.get_player_names()))
-       end
-})
-
-core.register_chatcommand("disconnect", {
-       description = "Exit to main menu",
-       func = function(param)
-               core.disconnect()
-       end,
-})