From ea492d89d08bc48a413f2c29f6a143c2f308070e Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 31 Mar 2017 21:51:44 -0500 Subject: Make compatible with plain Lua --- init.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 29d54db..a7abe63 100644 --- a/init.lua +++ b/init.lua @@ -43,7 +43,7 @@ minetest.register_on_receiving_chat_messages(function(message) end if string.sub(message,1,1) == "<" then msgtype = "channel" - user,text = string.match(message,"^<(%g*)> (.*)$") + user,text = string.match(message,"^<([^%c ]*)> (.*)$") if not user then msgtype = "special" text = message @@ -53,18 +53,17 @@ minetest.register_on_receiving_chat_messages(function(message) msgtype = "highlight_channel" end elseif string.sub(message,1,3) == "***" then - user,msgtype,text = string.match(message,"^*** (%g*) (%g*) the game. ?(.*)$") + user,msgtype,text = string.match(message,"^*** ([^%c ]*) ([^%c ]*) the game. ?(.*)$") if not text or text == "" then text = "(Client Quit)" end elseif string.sub(message,1,1) == "*" then msgtype = "action" - user,text = string.match(message,"^* (%g*) (.*)$") + user,text = string.match(message,"^* ([^%c ]*) (.*)$") if not user then msgtype = "special" text = message - end - if (user == player_name) or (string.match(user,"^(.*)@") == player_name) then + elseif (user == player_name) or (string.match(user,"^(.*)@") == player_name) then msgtype = "sent_action" elseif string.find(text,player_name) then msgtype = "highlight_action" -- cgit v1.2.3