-- automatically generated by the FlatBuffers compiler, do not modify

-- namespace: ppx

local flatbuffers = require('flatbuffers')

local Message = {} -- the module
local Message_mt = {} -- the class metatable

function Message.New()
    local o = {}
    setmetatable(o, {__index = Message_mt})
    return o
end
function Message.GetRootAsMessage(buf, offset)
    if type(buf) == "string" then
        buf = flatbuffers.binaryArray.New(buf)
    end
    local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
    local o = Message.New()
    o:Init(buf, n + offset)
    return o
end
function Message_mt:Init(buf, pos)
    self.view = flatbuffers.view.New(buf, pos)
end
function Message_mt:BodyType()
    local o = self.view:Offset(4)
    if o ~= 0 then
        return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
    end
    return 0
end
function Message_mt:Body()
    local o = self.view:Offset(6)
    if o ~= 0 then
        local obj = flatbuffers.view.New(require('flatbuffers.binaryarray').New(0), 0)
        self.view:Union(obj, o)
        return obj
    end
end
function Message.Start(builder) builder:StartObject(2) end
function Message.AddBodyType(builder, bodyType) builder:PrependUint8Slot(0, bodyType, 0) end
function Message.AddBody(builder, body) builder:PrependUOffsetTRelativeSlot(1, body, 0) end
function Message.End(builder) return builder:EndObject() end

return Message -- return the module