...

Text file src/github.com/google/flatbuffers/tests/TableA.lua

Documentation: github.com/google/flatbuffers/tests

     1--[[ TableA
     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: 23.5.26
     7
     8  Declared by  : //include_test/include_test1.fbs
     9  Rooting type : MyGame.Example.Monster (//monster_test.fbs)
    10
    11--]]
    12
    13local __MyGame_OtherNameSpace_TableB = require('MyGame.OtherNameSpace.TableB')
    14local flatbuffers = require('flatbuffers')
    15
    16local TableA = {}
    17local mt = {}
    18
    19function TableA.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:B()
    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 = __MyGame_OtherNameSpace_TableB.New()
    34    obj:Init(self.view.bytes, x)
    35    return obj
    36  end
    37end
    38
    39function TableA.Start(builder)
    40  builder:StartObject(1)
    41end
    42
    43function TableA.AddB(builder, b)
    44  builder:PrependStructSlot(0, b, 0)
    45end
    46
    47function TableA.End(builder)
    48  return builder:EndObject()
    49end
    50
    51return TableA

View as plain text