blob: f70f2c7bcde81c5e84547006dbfaaac34519d52e [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001-- automatically generated by the FlatBuffers compiler, do not modify
2
3-- namespace: NamespaceA
4
5local flatbuffers = require('flatbuffers')
6
7local TableInFirstNS = {} -- the module
8local TableInFirstNS_mt = {} -- the class metatable
9
10function TableInFirstNS.New()
11 local o = {}
12 setmetatable(o, {__index = TableInFirstNS_mt})
13 return o
14end
15function TableInFirstNS.GetRootAsTableInFirstNS(buf, offset)
16 local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
17 local o = TableInFirstNS.New()
18 o:Init(buf, n + offset)
19 return o
20end
21function TableInFirstNS_mt:Init(buf, pos)
22 self.view = flatbuffers.view.New(buf, pos)
23end
24function TableInFirstNS_mt:FooTable()
25 local o = self.view:Offset(4)
26 if o ~= 0 then
27 local x = self.view:Indirect(o + self.view.pos)
28 local obj = require('NamespaceA.NamespaceB.TableInNestedNS').New()
29 obj:Init(self.view.bytes, x)
30 return obj
31 end
32end
33function TableInFirstNS_mt:FooEnum()
34 local o = self.view:Offset(6)
35 if o ~= 0 then
36 return self.view:Get(flatbuffers.N.Int8, o + self.view.pos)
37 end
38 return 0
39end
40function TableInFirstNS_mt:FooStruct()
41 local o = self.view:Offset(8)
42 if o ~= 0 then
43 local x = o + self.view.pos
44 local obj = require('NamespaceA.NamespaceB.StructInNestedNS').New()
45 obj:Init(self.view.bytes, x)
46 return obj
47 end
48end
49function TableInFirstNS.Start(builder) builder:StartObject(3) end
50function TableInFirstNS.AddFooTable(builder, fooTable) builder:PrependUOffsetTRelativeSlot(0, fooTable, 0) end
51function TableInFirstNS.AddFooEnum(builder, fooEnum) builder:PrependInt8Slot(1, fooEnum, 0) end
52function TableInFirstNS.AddFooStruct(builder, fooStruct) builder:PrependStructSlot(2, fooStruct, 0) end
53function TableInFirstNS.End(builder) return builder:EndObject() end
54
55return TableInFirstNS -- return the module