Hey, this might be a stupid question, but I just looked into the code of one thing which I can't tell what it is, but you get the idea here:

static ChatCommand unbanCommandTable[] =
	{ "ip",        'm', &ChatHandler::HandleIPUnBanCommand,        "Deletes an address  from the IP ban table: <address>", NULL, 0, 0, 0 },
	{ "character", 'b', &ChatHandler::HandleUnBanCharacterCommand, "Unbans character x",                                         NULL, 0, 0, 0 },
	{ "account",   'z', &ChatHandler::HandleAccountUnbanCommand,   "Unbans account x.",                                        NULL, 0, 0, 0 },
	{ NULL,        '0', NULL,                                      "",                                         NULL, 0, 0, 0 }

There is a reference to function, I mean like I want to make similar system to the my little RPG like a hook system that I can like hook my own function to onCharacterMove or something like that, this is a bit sucky explanation I am sorry, but I guess someone knows what I mean :( I mean that I make a table where the hooks will be stored and the move function runs them from there ?

Edited by Silvershaft: n/a

6 Years
Discussion Span
Last Post by mike_2000_17

Well in the above, the "&function" syntax is a function pointer which you can Google for. And the "hooks" that you are talking about is, from what I understand of your explanation, what is commonly known as "callback functions" which is very heavily used, especially in C interfaced libraries (such as most APIs). Look up these terms and check back on this thread if you want further explanation. Also, function pointers are not very popular anymore in C++ (unless it is for legacy with a C library or interface) because "function objects" are much more convenient, look that up too.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.