forked from Mirrorlandia_minetest/minetest
CSM: Fix documentation error for register_on_*_chat_messages (#5917)
This commit is contained in:
parent
312ca0382b
commit
44495ea719
@ -1,7 +1,7 @@
|
|||||||
-- Minetest: builtin/client/chatcommands.lua
|
-- Minetest: builtin/client/chatcommands.lua
|
||||||
|
|
||||||
|
|
||||||
core.register_on_sending_chat_messages(function(message)
|
core.register_on_sending_chat_message(function(message)
|
||||||
if message:sub(1,2) == ".." then
|
if message:sub(1,2) == ".." then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -61,8 +61,8 @@ end
|
|||||||
core.registered_globalsteps, core.register_globalstep = make_registration()
|
core.registered_globalsteps, core.register_globalstep = make_registration()
|
||||||
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
||||||
core.registered_on_connect, core.register_on_connect = make_registration()
|
core.registered_on_connect, core.register_on_connect = make_registration()
|
||||||
core.registered_on_receiving_chat_messages, core.register_on_receiving_chat_messages = make_registration()
|
core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration()
|
||||||
core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages = make_registration()
|
core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration()
|
||||||
core.registered_on_death, core.register_on_death = make_registration()
|
core.registered_on_death, core.register_on_death = make_registration()
|
||||||
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
|
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
|
||||||
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()
|
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()
|
||||||
|
@ -30,13 +30,13 @@ core.register_on_item_use(function(itemstack, pointed_thing)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||||
core.register_on_receiving_chat_messages(function(message)
|
core.register_on_receiving_chat_message(function(message)
|
||||||
print("[PREVIEW] Received message " .. message)
|
print("[PREVIEW] Received message " .. message)
|
||||||
return false
|
return false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||||
core.register_on_sending_chat_messages(function(message)
|
core.register_on_sending_chat_message(function(message)
|
||||||
print("[PREVIEW] Sending message " .. message)
|
print("[PREVIEW] Sending message " .. message)
|
||||||
return false
|
return false
|
||||||
end)
|
end)
|
||||||
@ -155,4 +155,3 @@ core.register_chatcommand("privs", {
|
|||||||
return true, core.privs_to_string(minetest.get_privilege_list())
|
return true, core.privs_to_string(minetest.get_privilege_list())
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -648,10 +648,10 @@ Call these functions only at load time!
|
|||||||
semi-frequent intervals as well as on server shutdown.
|
semi-frequent intervals as well as on server shutdown.
|
||||||
* `minetest.register_on_connect(func())`
|
* `minetest.register_on_connect(func())`
|
||||||
* Called at the end of client connection (when player is loaded onto map)
|
* Called at the end of client connection (when player is loaded onto map)
|
||||||
* `minetest.register_on_receiving_chat_message(func(name, message))`
|
* `minetest.register_on_receiving_chat_message(func(message))`
|
||||||
* Called always when a client receive a message
|
* Called always when a client receive a message
|
||||||
* Return `true` to mark the message as handled, which means that it will not be shown to chat
|
* Return `true` to mark the message as handled, which means that it will not be shown to chat
|
||||||
* `minetest.register_on_sending_chat_message(func(name, message))`
|
* `minetest.register_on_sending_chat_message(func(message))`
|
||||||
* Called always when a client send a message from chat
|
* Called always when a client send a message from chat
|
||||||
* Return `true` to mark the message as handled, which means that it will not be sent to server
|
* Return `true` to mark the message as handled, which means that it will not be sent to server
|
||||||
* `minetest.register_chatcommand(cmd, chatcommand definition)`
|
* `minetest.register_chatcommand(cmd, chatcommand definition)`
|
||||||
|
@ -53,7 +53,7 @@ bool ScriptApiClient::on_sending_message(const std::string &message)
|
|||||||
|
|
||||||
// Get core.registered_on_chat_messages
|
// Get core.registered_on_chat_messages
|
||||||
lua_getglobal(L, "core");
|
lua_getglobal(L, "core");
|
||||||
lua_getfield(L, -1, "registered_on_sending_chat_messages");
|
lua_getfield(L, -1, "registered_on_sending_chat_message");
|
||||||
// Call callbacks
|
// Call callbacks
|
||||||
lua_pushstring(L, message.c_str());
|
lua_pushstring(L, message.c_str());
|
||||||
runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC);
|
runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC);
|
||||||
@ -67,7 +67,7 @@ bool ScriptApiClient::on_receiving_message(const std::string &message)
|
|||||||
|
|
||||||
// Get core.registered_on_chat_messages
|
// Get core.registered_on_chat_messages
|
||||||
lua_getglobal(L, "core");
|
lua_getglobal(L, "core");
|
||||||
lua_getfield(L, -1, "registered_on_receiving_chat_messages");
|
lua_getfield(L, -1, "registered_on_receiving_chat_message");
|
||||||
// Call callbacks
|
// Call callbacks
|
||||||
lua_pushstring(L, message.c_str());
|
lua_pushstring(L, message.c_str());
|
||||||
runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC);
|
runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC);
|
||||||
|
Loading…
Reference in New Issue
Block a user