...

Text file src/github.com/google/flatbuffers/tests/namespace_test/NamespaceC/TableInC.lua

Documentation: github.com/google/flatbuffers/tests/namespace_test/NamespaceC

     1-- automatically generated by the FlatBuffers compiler, do not modify
     2
     3-- namespace: NamespaceC
     4
     5local flatbuffers = require('flatbuffers')
     6
     7local TableInC = {} -- the module
     8local TableInC_mt = {} -- the class metatable
     9
    10function TableInC.New()
    11    local o = {}
    12    setmetatable(o, {__index = TableInC_mt})
    13    return o
    14end
    15function TableInC.GetRootAsTableInC(buf, offset)
    16    if type(buf) == "string" then
    17        buf = flatbuffers.binaryArray.New(buf)
    18    end
    19    local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
    20    local o = TableInC.New()
    21    o:Init(buf, n + offset)
    22    return o
    23end
    24function TableInC_mt:Init(buf, pos)
    25    self.view = flatbuffers.view.New(buf, pos)
    26end
    27function TableInC_mt:ReferToA1()
    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.TableInFirstNS').New()
    32        obj:Init(self.view.bytes, x)
    33        return obj
    34    end
    35end
    36function TableInC_mt:ReferToA2()
    37    local o = self.view:Offset(6)
    38    if o ~= 0 then
    39        local x = self.view:Indirect(o + self.view.pos)
    40        local obj = require('NamespaceA.SecondTableInA').New()
    41        obj:Init(self.view.bytes, x)
    42        return obj
    43    end
    44end
    45function TableInC.Start(builder) builder:StartObject(2) end
    46function TableInC.AddReferToA1(builder, referToA1) builder:PrependUOffsetTRelativeSlot(0, referToA1, 0) end
    47function TableInC.AddReferToA2(builder, referToA2) builder:PrependUOffsetTRelativeSlot(1, referToA2, 0) end
    48function TableInC.End(builder) return builder:EndObject() end
    49
    50return TableInC -- return the module

View as plain text