Skip to content

Commit

Permalink
fix(callback): multi-return values for callback method
Browse files Browse the repository at this point in the history
Resolves #136
  • Loading branch information
thelindat committed Oct 24, 2022
1 parent 541e708 commit 03dcf14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion imports/callback/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ local function triggerServerCallback(_, event, delay, cb, ...)
return promise:resolve(response and { msgpack.unpack(response) } or {})
end

return cb and cb(response and msgpack.unpack(response))
if cb and response then
cb(msgpack.unpack(response))
end
end

if promise then
Expand Down
4 changes: 3 additions & 1 deletion imports/callback/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ local function triggerClientCallback(_, event, playerId, cb, ...)
return promise:resolve(response and { msgpack.unpack(response) } or {})
end

return cb and cb(response and msgpack.unpack(response))
if cb and response then
cb(msgpack.unpack(response))
end
end

if promise then
Expand Down

0 comments on commit 03dcf14

Please sign in to comment.