mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Rename SQF/dayz_code/util/Request_Server.hpp to Server Files/Archive/dayz_code/util/Request_Server.hpp
This commit is contained in:
33
Server Files/Archive/dayz_code/util/Request_Server.hpp
Normal file
33
Server Files/Archive/dayz_code/util/Request_Server.hpp
Normal 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
|
||||
Reference in New Issue
Block a user