forked from VoxeLibre/VoxeLibre
Added informative return value to vl_client_interface.send_message
This commit is contained in:
parent
df198fc9a2
commit
7bca2730f0
|
@ -24,7 +24,7 @@ minetest.register_on_mods_loaded(connect_server)
|
|||
-- data: table to be sent to client, must be json serialisable
|
||||
local function send_data(data)
|
||||
-- TODO: Should channel ever be nil?
|
||||
if not channel then return end
|
||||
if not vl_client.is_connected then return end
|
||||
|
||||
local string_data = minetest.write_json(data)
|
||||
--minetest.debug("Sending data from server to modchannel:", string_data)
|
||||
|
@ -35,7 +35,7 @@ end
|
|||
-- opname: the name of the category of this message
|
||||
-- message: any json-serialisable object (not necessarily table)
|
||||
function vl_client_interface.send_message(playername, opname, message)
|
||||
send_data({playername, opname, message})
|
||||
return send_data({playername, opname, message})
|
||||
end
|
||||
|
||||
-- ON MESSAGE RECEIVED
|
||||
|
|
|
@ -8,7 +8,10 @@ minetest.register_chatcommand("ping", {
|
|||
if matched == nil then
|
||||
return false, "Invalid arguments, see /help ping"
|
||||
end
|
||||
vl_client_interface.send_message(player_name, "ping", {type="request", content=content})
|
||||
local send_status = vl_client_interface.send_message(player_name, "ping", {type="request", content=content})
|
||||
if not send_status then
|
||||
return false, "Server: unable to send ping"
|
||||
end
|
||||
return true, "Server: pinged client " .. player_name .. ": " .. content
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue