Skip to content

Commit

Permalink
localize a few variables, stricter luacheckrc
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Jan 3, 2021
1 parent d6dd750 commit d61f09b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
allow_defined_top = true

globals = {
"beerchat"
Expand Down
4 changes: 2 additions & 2 deletions format_message.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

function format_string(s, tab)
local function format_string(s, tab)
return (s:gsub('($%b{})', function(w) return tab[w:sub(3, -2)] or w end))
end

function colorize_target_name(s, target)
local function colorize_target_name(s, target)
if not target or not s then
return s
end
Expand Down
2 changes: 1 addition & 1 deletion hash.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

-- # chat a.k.a. hash chat/ channel chat code, to send messages in chat channels using #
-- e.g. #my channel: hello everyone in my channel!
hashchat_lastrecv = {}
local hashchat_lastrecv = {}

minetest.register_on_chat_message(function(name, message)
local msg_data = {name=name,message=message}
Expand Down
9 changes: 8 additions & 1 deletion pm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ local private_message_sound = "beerchat_chime" -- Sound when you receive a priv
local self_message_sound = "beerchat_utter" -- Sound when you send a private message to yourself

-- @ chat a.k.a. at chat/ PM chat code, to PM players using @player1 only you can read this player1!!
atchat_lastrecv = {}
local atchat_lastrecv = {}

-- cleanup upon leave
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
atchat_lastrecv[name] = nil
end)


minetest.register_on_chat_message(function(name, message)
minetest.log("action", "CHAT " .. name .. ": " .. message)
Expand Down
2 changes: 0 additions & 2 deletions session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
beerchat.playersChannels[name] = nil
atchat_lastrecv[name] = nil
beerchat.currentPlayerChannel[name] = nil
end)

2 changes: 1 addition & 1 deletion web/rx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local http = beerchat.http
local recv_loop

function handle_data(data)
local function handle_data(data)
if not data or not data.username or not data.message or not data.name then
return
end
Expand Down

0 comments on commit d61f09b

Please sign in to comment.