mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 14:15:17 +00:00
[Lua] GetRootAs can accept strings. Made Luatest Benchmarks optional (#6593)
This commit is contained in:
@@ -14,6 +14,9 @@ function Monster.New()
|
||||
return o
|
||||
end
|
||||
function Monster.GetRootAsMonster(buf, offset)
|
||||
if type(buf) == "string" then
|
||||
buf = flatbuffers.binaryArray.New(buf)
|
||||
end
|
||||
local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
|
||||
local o = Monster.New()
|
||||
o:Init(buf, n + offset)
|
||||
|
||||
Reference in New Issue
Block a user