diff --git a/imports/callback/client.lua b/imports/callback/client.lua index 6535bda..0e61f85 100644 --- a/imports/callback/client.lua +++ b/imports/callback/client.lua @@ -68,9 +68,14 @@ end ---@overload fun(event: string, delay: number | false, cb: function, ...) lib.callback = setmetatable({}, { __call = function(_, event, delay, cb, ...) - local cbType = type(cb) + if not cb then + warn(("callback event '%s' does not have a function to callback to and will instead await\nuse lib.callback.await or a regular event to remove this warning") + :format(event)) + else + local cbType = type(cb) - assert(cbType == 'function', ("expected argument 3 to have type 'function' (received %s)"):format(cbType)) + assert(cbType == 'function', ("expected argument 3 to have type 'function' (received %s)"):format(cbType)) + end return triggerServerCallback(_, event, delay, cb, ...) end diff --git a/imports/callback/server.lua b/imports/callback/server.lua index 65eef3e..5309a4a 100644 --- a/imports/callback/server.lua +++ b/imports/callback/server.lua @@ -51,9 +51,14 @@ end ---@overload fun(event: string, playerId: number, cb: function, ...) lib.callback = setmetatable({}, { __call = function(_, event, playerId, cb, ...) - local cbType = type(cb) + if not cb then + warn(("callback event '%s' does not have a function to callback to and will instead await\nuse lib.callback.await or a regular event to remove this warning") + :format(event)) + else + local cbType = type(cb) - assert(cbType == 'function', ("expected argument 3 to have type 'function' (received %s)"):format(cbType)) + assert(cbType == 'function', ("expected argument 3 to have type 'function' (received %s)"):format(cbType)) + end return triggerClientCallback(_, event, playerId, cb, ...) end