0
点赞
收藏
分享

微信扫一扫

游戏后端如何实现服务器之间的负载均衡?

杰克逊爱学习 02-12 20:00 阅读 2
luajsonjunit

Time: 2024年2月8日20:21:17 by:MemoryErHero

1 异常代码

Expected value but found T_END at character 1

2 异常代码

Expected value but found T_OBJ_END at character 22

3 处理方案 - 正确 json 示范

while true do
	--Expected value but found T_END at character 1
    --Expected value but found T_OBJ_END at character 22
	local str = '{"success":0,"code":[]}'
	local err,tbl = pcall(function(str)return jsonLib.decode(str)end,str)
	print(err)
	print(tbl)
    sleep(1000)
end

在这里插入图片描述

4 处理方案 - 错误 json 示范

while true do
	--Expected value but found T_END at character 1
    --Expected value but found T_OBJ_END at character 22
	local str = '{"success":0,"code":[}'
	local err,tbl = pcall(function(str)return jsonLib.decode(str)end,str)
	print(err)
	print(tbl)
    sleep(1000)
end

在这里插入图片描述

举报

相关推荐

0 条评论