Created
July 4, 2018 16:55
-
-
Save c0ldfront/13d180af14c06a4967521703e77a621f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local nk = require("nakama") | |
local function f_after_match_maker(context, payload) | |
-- for key, value in pairs(context) do | |
-- print(("key %q :: value %q"):format(key, value)) | |
-- end | |
-- for key, value in pairs(payload) do | |
-- -- print(("key %q :: value %q"):format(key, value)) | |
-- if(key == "match_join") then | |
-- for k,v in pairs(value) do | |
-- print(("k: %q :: v: %q"):format(k,v)) | |
-- end | |
-- end | |
-- end | |
-- nk.logger_info(context.match_id) | |
local token = GetToken(payload.match_join.token) | |
local decodedtoken = nk.base64_decode(token) | |
print(decodedtoken) | |
end | |
function GetToken(jwt) | |
local token | |
local index = 0 | |
for i in string.gmatch(jwt, "[^%.]+") do | |
if(index == 1) then | |
token = i | |
break | |
end | |
index = index + 1 | |
end | |
return token | |
end | |
nk.register_rt_after(f_after_match_maker,"MatchJoin") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment