我使用的是Node.js module
,它返回一个需要转换为字符串或64-bit integer
的值。返回的值如下所示:
{ low: 214107458, high: 17825793, unsigned: true }
文档指出它是一种叫做decimal string
的东西。我不知道那是什么意思。我想要的值假设如下:76561198174373186
如何转换?
这是我从中获取值的模块:https://github.com/seishun/node-steam
具体而言,此代码:https://github.com/seishun/node-steam/blob/84cc4f870b8da4755ba057acff336a093891458f/lib/handlers/friends/index.js
这是我需要将转换后的值发送到的模块:https://github.com/Lwatt/node-steam-userinfo/blob/master/index.js
我的代码:
steamFriends.on('friendMsg', function(steamID, message, type) {
if(type != Steam.EChatEntryType.ChatMsg) return;
steamuserinfo.getUserInfo(steamID, function(error, data){
if(error) throw error;
var datadec = JSON.parse(JSON.stringify(data.response)); //This returns an empty array because steamID is in incorrect form.
console.log(steamID); //Output: { low: 214107458, high: 17825793, unsigned: true }
});
});
我不知道是什么意思
它是这样工作的:76561198174373186=17825793*10^32+2214107458
注意,要转换为"76561198174373186"字符串,最简单的方法是使用支持lib、G.I.Y.F.的64位整数