Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame^] | 1 | -- automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | -- namespace: NamespaceA |
| 4 | |
| 5 | local flatbuffers = require('flatbuffers') |
| 6 | |
| 7 | local TableInFirstNS = {} -- the module |
| 8 | local TableInFirstNS_mt = {} -- the class metatable |
| 9 | |
| 10 | function TableInFirstNS.New() |
| 11 | local o = {} |
| 12 | setmetatable(o, {__index = TableInFirstNS_mt}) |
| 13 | return o |
| 14 | end |
| 15 | function 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 |
| 20 | end |
| 21 | function TableInFirstNS_mt:Init(buf, pos) |
| 22 | self.view = flatbuffers.view.New(buf, pos) |
| 23 | end |
| 24 | function 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 |
| 32 | end |
| 33 | function 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 |
| 39 | end |
| 40 | function 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 |
| 48 | end |
| 49 | function TableInFirstNS.Start(builder) builder:StartObject(3) end |
| 50 | function TableInFirstNS.AddFooTable(builder, fooTable) builder:PrependUOffsetTRelativeSlot(0, fooTable, 0) end |
| 51 | function TableInFirstNS.AddFooEnum(builder, fooEnum) builder:PrependInt8Slot(1, fooEnum, 0) end |
| 52 | function TableInFirstNS.AddFooStruct(builder, fooStruct) builder:PrependStructSlot(2, fooStruct, 0) end |
| 53 | function TableInFirstNS.End(builder) return builder:EndObject() end |
| 54 | |
| 55 | return TableInFirstNS -- return the module |