• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1-- automatically generated by the FlatBuffers compiler, do not modify
2
3-- namespace: Example
4
5local flatbuffers = require('flatbuffers')
6
7local Stat = {} -- the module
8local Stat_mt = {} -- the class metatable
9
10function Stat.New()
11    local o = {}
12    setmetatable(o, {__index = Stat_mt})
13    return o
14end
15function Stat.GetRootAsStat(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 = Stat.New()
21    o:Init(buf, n + offset)
22    return o
23end
24function Stat_mt:Init(buf, pos)
25    self.view = flatbuffers.view.New(buf, pos)
26end
27function Stat_mt:Id()
28    local o = self.view:Offset(4)
29    if o ~= 0 then
30        return self.view:String(o + self.view.pos)
31    end
32end
33function Stat_mt:Val()
34    local o = self.view:Offset(6)
35    if o ~= 0 then
36        return self.view:Get(flatbuffers.N.Int64, o + self.view.pos)
37    end
38    return 0
39end
40function Stat_mt:Count()
41    local o = self.view:Offset(8)
42    if o ~= 0 then
43        return self.view:Get(flatbuffers.N.Uint16, o + self.view.pos)
44    end
45    return 0
46end
47function Stat.Start(builder) builder:StartObject(3) end
48function Stat.AddId(builder, id) builder:PrependUOffsetTRelativeSlot(0, id, 0) end
49function Stat.AddVal(builder, val) builder:PrependInt64Slot(1, val, 0) end
50function Stat.AddCount(builder, count) builder:PrependUint16Slot(2, count, 0) end
51function Stat.End(builder) return builder:EndObject() end
52
53return Stat -- return the module