xref: /aosp_15_r20/external/flatbuffers/tests/namespace_test/NamespaceA/SecondTableInA.lua (revision 890232f25432b36107d06881e0a25aaa6b473652)
1-- automatically generated by the FlatBuffers compiler, do not modify
2
3-- namespace: NamespaceA
4
5local flatbuffers = require('flatbuffers')
6
7local SecondTableInA = {} -- the module
8local SecondTableInA_mt = {} -- the class metatable
9
10function SecondTableInA.New()
11    local o = {}
12    setmetatable(o, {__index = SecondTableInA_mt})
13    return o
14end
15function SecondTableInA.GetRootAsSecondTableInA(buf, offset)
16    if type(buf) == "string" then
17        buf = flatbuffers.binaryArray.New(buf)
18    end
19    local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
20    local o = SecondTableInA.New()
21    o:Init(buf, n + offset)
22    return o
23end
24function SecondTableInA_mt:Init(buf, pos)
25    self.view = flatbuffers.view.New(buf, pos)
26end
27function SecondTableInA_mt:ReferToC()
28    local o = self.view:Offset(4)
29    if o ~= 0 then
30        local x = self.view:Indirect(o + self.view.pos)
31        local obj = require('NamespaceC.TableInC').New()
32        obj:Init(self.view.bytes, x)
33        return obj
34    end
35end
36function SecondTableInA.Start(builder) builder:StartObject(1) end
37function SecondTableInA.AddReferToC(builder, referToC) builder:PrependUOffsetTRelativeSlot(0, referToC, 0) end
38function SecondTableInA.End(builder) return builder:EndObject() end
39
40return SecondTableInA -- return the module