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) |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 16 | if type(buf) == "string" then |
| 17 | buf = flatbuffers.binaryArray.New(buf) |
| 18 | end |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 19 | local n = flatbuffers.N.UOffsetT:Unpack(buf, offset) |
| 20 | local o = TableInFirstNS.New() |
| 21 | o:Init(buf, n + offset) |
| 22 | return o |
| 23 | end |
| 24 | function TableInFirstNS_mt:Init(buf, pos) |
| 25 | self.view = flatbuffers.view.New(buf, pos) |
| 26 | end |
| 27 | function TableInFirstNS_mt:FooTable() |
| 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('NamespaceA.NamespaceB.TableInNestedNS').New() |
| 32 | obj:Init(self.view.bytes, x) |
| 33 | return obj |
| 34 | end |
| 35 | end |
| 36 | function TableInFirstNS_mt:FooEnum() |
| 37 | local o = self.view:Offset(6) |
| 38 | if o ~= 0 then |
| 39 | return self.view:Get(flatbuffers.N.Int8, o + self.view.pos) |
| 40 | end |
| 41 | return 0 |
| 42 | end |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 43 | function TableInFirstNS_mt:FooUnionType() |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 44 | local o = self.view:Offset(8) |
| 45 | if o ~= 0 then |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 46 | return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos) |
| 47 | end |
| 48 | return 0 |
| 49 | end |
| 50 | function TableInFirstNS_mt:FooUnion() |
| 51 | local o = self.view:Offset(10) |
| 52 | if o ~= 0 then |
| 53 | local obj = flatbuffers.view.New(require('flatbuffers.binaryarray').New(0), 0) |
| 54 | self.view:Union(obj, o) |
| 55 | return obj |
| 56 | end |
| 57 | end |
| 58 | function TableInFirstNS_mt:FooStruct() |
| 59 | local o = self.view:Offset(12) |
| 60 | if o ~= 0 then |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 61 | local x = o + self.view.pos |
| 62 | local obj = require('NamespaceA.NamespaceB.StructInNestedNS').New() |
| 63 | obj:Init(self.view.bytes, x) |
| 64 | return obj |
| 65 | end |
| 66 | end |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 67 | function TableInFirstNS.Start(builder) builder:StartObject(5) end |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 68 | function TableInFirstNS.AddFooTable(builder, fooTable) builder:PrependUOffsetTRelativeSlot(0, fooTable, 0) end |
| 69 | function TableInFirstNS.AddFooEnum(builder, fooEnum) builder:PrependInt8Slot(1, fooEnum, 0) end |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 70 | function TableInFirstNS.AddFooUnionType(builder, fooUnionType) builder:PrependUint8Slot(2, fooUnionType, 0) end |
| 71 | function TableInFirstNS.AddFooUnion(builder, fooUnion) builder:PrependUOffsetTRelativeSlot(3, fooUnion, 0) end |
| 72 | function TableInFirstNS.AddFooStruct(builder, fooStruct) builder:PrependStructSlot(4, fooStruct, 0) end |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 73 | function TableInFirstNS.End(builder) return builder:EndObject() end |
| 74 | |
| 75 | return TableInFirstNS -- return the module |