Skip to content

Commit 44495ea

Browse files
Desournerzhul
authored andcommittedJun 9, 2017
CSM: Fix documentation error for register_on_*_chat_messages (#5917)
1 parent 312ca03 commit 44495ea

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed
 

Diff for: ‎builtin/client/chatcommands.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- Minetest: builtin/client/chatcommands.lua
22

33

4-
core.register_on_sending_chat_messages(function(message)
4+
core.register_on_sending_chat_message(function(message)
55
if message:sub(1,2) == ".." then
66
return false
77
end

Diff for: ‎builtin/client/register.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ end
6161
core.registered_globalsteps, core.register_globalstep = make_registration()
6262
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
6363
core.registered_on_connect, core.register_on_connect = make_registration()
64-
core.registered_on_receiving_chat_messages, core.register_on_receiving_chat_messages = make_registration()
65-
core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages = make_registration()
64+
core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration()
65+
core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration()
6666
core.registered_on_death, core.register_on_death = make_registration()
6767
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
6868
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()

Diff for: ‎clientmods/preview/init.lua

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ core.register_on_item_use(function(itemstack, pointed_thing)
3030
end)
3131

3232
-- This is an example function to ensure it's working properly, should be removed before merge
33-
core.register_on_receiving_chat_messages(function(message)
33+
core.register_on_receiving_chat_message(function(message)
3434
print("[PREVIEW] Received message " .. message)
3535
return false
3636
end)
3737

3838
-- This is an example function to ensure it's working properly, should be removed before merge
39-
core.register_on_sending_chat_messages(function(message)
39+
core.register_on_sending_chat_message(function(message)
4040
print("[PREVIEW] Sending message " .. message)
4141
return false
4242
end)
@@ -155,4 +155,3 @@ core.register_chatcommand("privs", {
155155
return true, core.privs_to_string(minetest.get_privilege_list())
156156
end,
157157
})
158-

Diff for: ‎doc/client_lua_api.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,10 @@ Call these functions only at load time!
648648
semi-frequent intervals as well as on server shutdown.
649649
* `minetest.register_on_connect(func())`
650650
* Called at the end of client connection (when player is loaded onto map)
651-
* `minetest.register_on_receiving_chat_message(func(name, message))`
651+
* `minetest.register_on_receiving_chat_message(func(message))`
652652
* Called always when a client receive a message
653653
* Return `true` to mark the message as handled, which means that it will not be shown to chat
654-
* `minetest.register_on_sending_chat_message(func(name, message))`
654+
* `minetest.register_on_sending_chat_message(func(message))`
655655
* Called always when a client send a message from chat
656656
* Return `true` to mark the message as handled, which means that it will not be sent to server
657657
* `minetest.register_chatcommand(cmd, chatcommand definition)`
@@ -676,7 +676,7 @@ Call these functions only at load time!
676676
* Called when the local player punches a node
677677
* Newest functions are called first
678678
* If any function returns true, the punch is ignored
679-
* `minetest.register_on_placenode(function(pointed_thing, node))`
679+
* `minetest.register_on_placenode(function(pointed_thing, node))`
680680
* Called when a node has been placed
681681
* `minetest.register_on_item_use(func(item, pointed_thing))`
682682
* Called when the local player uses an item.

Diff for: ‎src/script/cpp_api/s_client.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool ScriptApiClient::on_sending_message(const std::string &message)
5353

5454
// Get core.registered_on_chat_messages
5555
lua_getglobal(L, "core");
56-
lua_getfield(L, -1, "registered_on_sending_chat_messages");
56+
lua_getfield(L, -1, "registered_on_sending_chat_message");
5757
// Call callbacks
5858
lua_pushstring(L, message.c_str());
5959
runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC);
@@ -67,7 +67,7 @@ bool ScriptApiClient::on_receiving_message(const std::string &message)
6767

6868
// Get core.registered_on_chat_messages
6969
lua_getglobal(L, "core");
70-
lua_getfield(L, -1, "registered_on_receiving_chat_messages");
70+
lua_getfield(L, -1, "registered_on_receiving_chat_message");
7171
// Call callbacks
7272
lua_pushstring(L, message.c_str());
7373
runCallbacks(1, RUN_CALLBACKS_MODE_OR_SC);

0 commit comments

Comments
 (0)
Please sign in to comment.