[Lua] GetRootAs can accept strings. Made Luatest Benchmarks optional (#6593)

This commit is contained in:
Derek Bailey
2021-04-27 13:02:13 -07:00
committed by GitHub
parent 16836ff95a
commit 14725d6c3b
13 changed files with 71 additions and 0 deletions

View File

@@ -13,6 +13,9 @@ function Referrable.New()
return o
end
function Referrable.GetRootAsReferrable(buf, offset)
if type(buf) == "string" then
buf = flatbuffers.binaryArray.New(buf)
end
local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
local o = Referrable.New()
o:Init(buf, n + offset)