Callbacks

Within the library is a standalone callback system.

The intention with this is to replace the need for creating multiple individual callback's for a variety of frameworks.

Client Functions

utils.callback.cb = callback

cb

The following is used to retrieve data from the server to client. Callback's must be registered first in order to retrieve.

What makes the callback system a little different is the data_to_send this allows the options of attaching validation data to the callback, however you should always exercise caution when doing this.

Never trust the client.

utils.callback.cb('event_name', data_to_send, function(response) ... end)

Attaching data to this table from the client side, should only be done in situations where data validity is less crucial. 9/10 you should leave this as "nil".

Server Functions

utils.callback.register = register_callback
utils.callback.validate_distance = validate_distance

register

The following can be used to register a callback on the server.

utils.callback.register('event_name', function() ... end)

Callbacks

validate_distance

The following is an internal callback used by utils to add additional validation data to framework actions such as giving items. However this can be used externally if you like.

utils.callback.validate_distance(_src, { location = vector3(0, 0, 0), distance = 5.0 }, function() ... end)

Last updated