diff --git a/imports/callbacks/client.lua b/imports/callbacks/client.lua index c44cd7e..7361405 100644 --- a/imports/callbacks/client.lua +++ b/imports/callbacks/client.lua @@ -12,9 +12,9 @@ end local ServerCallback = table.create(0, 2) ---- Sends an event to the server and halts the current thread until a response is returned. ---@param event string ---@param delay number +--- Sends an event to the server and halts the current thread until a response is returned. ServerCallback.Await = function(resource, event, delay, ...) CallbackTimer(event, delay) event = ('__cb_%s:%s'):format(resource, event) @@ -27,9 +27,9 @@ ServerCallback.Await = function(resource, event, delay, ...) return table.unpack(Citizen.Await(promise)) end ---- Sends an event to the server and triggers a callback function once the response is returned. ---@param event string ---@param delay number +--- Sends an event to the server and triggers a callback function once the response is returned. ServerCallback.Async = function(resource, event, delay, cb, ...) CallbackTimer(event, delay) event = ('__cb_%s:%s'):format(resource, event) diff --git a/imports/callbacks/server.lua b/imports/callbacks/server.lua index 16d4bc5..59944e1 100644 --- a/imports/callbacks/server.lua +++ b/imports/callbacks/server.lua @@ -1,5 +1,9 @@ -local ServerCallback = { - Register = function(name, callback) +local ServerCallback = {} + + ---@param name string + ---@param callback function + --- Registers an event handler and callback function to respond to client requests. + ServerCallback.Register = function(name, callback) name = ('__cb_%s:%s'):format(GetCurrentResourceName(), name) RegisterServerEvent(name, function(...) diff --git a/init.lua b/init.lua index be1dd37..6bd5e65 100644 --- a/init.lua +++ b/init.lua @@ -6,7 +6,7 @@ local LIBRARY = 'pe-lualib' local SERVICE = IsDuplicityVersion() and 'server' or 'client' local IMPORTS = {} -local function loadFile(file) +local function LoadFile(file) local dir = ('imports/%s'):format(file) local chunk = LoadResourceFile(LIBRARY, ('%s/%s.lua'):format(dir, SERVICE)) local shared = LoadResourceFile(LIBRARY, ('%s/shared.lua'):format(dir)) @@ -29,7 +29,7 @@ end ---@param file string ---@return table function import(file) - if not IMPORTS[file] then loadFile(file) end + if not IMPORTS[file] then LoadFile(file) end return IMPORTS[file] end