localize a few variables, stricter luacheckrc
This commit is contained in:
parent
d6dd750dfd
commit
d61f09b135
@ -1,4 +1,3 @@
|
||||
allow_defined_top = true
|
||||
|
||||
globals = {
|
||||
"beerchat"
|
||||
|
@ -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
|
||||
|
2
hash.lua
2
hash.lua
@ -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}
|
||||
|
9
pm.lua
9
pm.lua
@ -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)
|
||||
|
@ -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,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user