Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json插件如何正确使用 #6

Closed
bluesky0521 opened this issue Nov 23, 2023 · 2 comments
Closed

json插件如何正确使用 #6

bluesky0521 opened this issue Nov 23, 2023 · 2 comments

Comments

@bluesky0521
Copy link
Contributor

function M.create_pack(encode)
	return function(name,tab)
		assert(name)
		assert(tab)
	
		local ok,str = encode(name,tab)
		if not ok then
			return nil,str
		end
	
		local pbmsgbuff = spack(">I2",name:len()) .. name .. str
		return pbmsgbuff
	end
end

打包json消息的时候也要传入packname吗?

@huahua132
Copy link
Owner

是的, 可以参考 examples/digitalbomb

@huahua132
Copy link
Owner

在 lualib/utils/net 中有各种协议网络打包工具

Repository owner locked and limited conversation to collaborators Nov 23, 2023
@huahua132 huahua132 converted this issue into discussion #9 Nov 23, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants