Rename SQF/dayz_code/util/Request_Server.hpp to Server Files/Archive/dayz_code/util/Request_Server.hpp

This commit is contained in:
worldwidesorrow
2020-01-21 11:47:55 -06:00
committed by GitHub
parent 138c469388
commit b4587ddf99

View File

@@ -0,0 +1,33 @@
/* See Request.hpp
Do not use this header on the client.
Author: Foxy
*/
#include "Array.hpp"
#include "Dictionary.hpp"
#ifndef _INCLUDE_GUARD_REQUEST
#define _INCLUDE_GUARD_REQUEST
assert (isServer);
/* Registers a request handler.
Parameters:
string/scalar id
String or number used as an identifier for the function.
String identifiers are case sensitive.
code handler
Function that handles the request.
If handler return nil an empty array is instead sent to the client.
boolean async
Indicates whether the request should be handled asynchronously (handler is spawned).
Example:
Request_RegisterHandler("GetDate", {my_global_date_variable}, false);
Request_RegisterHandler("GetObjectOwner", {owner _this}, false);
Request_RegisterHandler("DoSomething", _my_complicated_asynchronous_handler, true);
*/
#define Request_RegisterHandler(id, handler, async) Dictionary_Add(dz_request_handlers, id, Array_New2(handler, async))
#undef