xref: /aosp_15_r20/external/flatbuffers/tests/MyGame/OtherNameSpace/TableB.lua (revision 890232f25432b36107d06881e0a25aaa6b473652)
1--[[ MyGame.OtherNameSpace.TableB
2
3  Automatically generated by the FlatBuffers compiler, do not modify.
4  Or modify. I'm a message, not a cop.
5
6  flatc version: 2.0.7
7
8  Declared by  : //include_test/sub/include_test2.fbs
9  Rooting type : MyGame.Example.Monster (//monster_test.fbs)
10
11--]]
12
13local __TableA = require('TableA')
14local flatbuffers = require('flatbuffers')
15
16local TableB = {}
17local mt = {}
18
19function TableB.New()
20  local o = {}
21  setmetatable(o, {__index = mt})
22  return o
23end
24
25function mt:Init(buf, pos)
26  self.view = flatbuffers.view.New(buf, pos)
27end
28
29function mt:A()
30  local o = self.view:Offset(4)
31  if o ~= 0 then
32    local x = self.view:Indirect(self.view.pos + o)
33    local obj = __TableA.New()
34    obj:Init(self.view.bytes, x)
35    return obj
36  end
37end
38
39function TableB.Start(builder)
40  builder:StartObject(1)
41end
42
43function TableB.AddA(builder, a)
44  builder:PrependStructSlot(0, a, 0)
45end
46
47function TableB.End(builder)
48  return builder:EndObject()
49end
50
51return TableB