Skip to content

Commit 4e2479e

Browse files
red-001nerzhul
authored andcommittedApr 11, 2017
[CSM] Allow escaping chatcommands and add missing calls to gettext. (#5565)
1 parent a3e7372 commit 4e2479e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
 

Diff for: ‎builtin/client/chatcommands.lua

+8-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33

44
core.register_on_sending_chat_messages(function(message)
5+
if message:sub(1,2) == ".." then
6+
return false
7+
end
8+
59
local first_char = message:sub(1,1)
610
if first_char == "/" or first_char == "." then
711
core.display_chat_message(core.gettext("issued command: ") .. message)
@@ -12,9 +16,7 @@ core.register_on_sending_chat_messages(function(message)
1216
end
1317

1418
local cmd, param = string.match(message, "^%.([^ ]+) *(.*)")
15-
if not param then
16-
param = ""
17-
end
19+
param = param or ""
1820

1921
if not cmd then
2022
core.display_chat_message(core.gettext("-!- Empty command"))
@@ -36,15 +38,15 @@ core.register_on_sending_chat_messages(function(message)
3638
end)
3739

3840
core.register_chatcommand("list_players", {
39-
description = "List online players",
41+
description = core.gettext("List online players"),
4042
func = function(param)
4143
local players = table.concat(core.get_player_names(), ", ")
42-
core.display_chat_message("Online players: " .. players)
44+
core.display_chat_message(core.gettext("Online players: ") .. players)
4345
end
4446
})
4547

4648
core.register_chatcommand("disconnect", {
47-
description = "Exit to main menu",
49+
description = core.gettext("Exit to main menu"),
4850
func = function(param)
4951
core.disconnect()
5052
end,

0 commit comments

Comments
 (0)
Please sign in to comment.