We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
local pb = require "pb" local protoc = require "protoc" assert(protoc:load [[ message Phone { optional string name = 1; optional int64 phonenumber = 2; optional Person item = 3; } message Person { optional string name = 1; optional int32 age = 2; optional string address = 3; repeated Phone contacts = 4; } ]]) local data = { name = "ilse", age = 18, contacts = { { name = "alice", phonenumber = 12312341234 } } } data.contacts[1].item = data local bytes = pb.encode("Person", data)
执行这段代码会得到如下结果
lua: a.lua:26: stack overflow (message too many levels) stack traceback: [C]: in function 'encode' a.lua:26: in main chunk [C]: ?
虽然可以利用pcall来解决,但是是否应该在encode中对这种数据循环引用的情况做一些检查来避免栈满的情况呢?
The text was updated successfully, but these errors were encountered:
这种肯定是直接报error的,没别的处理方法。lua-pb的设计是尽量不做检查,以提高性能。
Sorry, something went wrong.
No branches or pull requests
执行这段代码会得到如下结果
虽然可以利用pcall来解决,但是是否应该在encode中对这种数据循环引用的情况做一些检查来避免栈满的情况呢?
The text was updated successfully, but these errors were encountered: