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 local n = flatbuffers.N.UOffsetT:Unpack(buf, offset) 17 local o = Stat.New() 18 o:Init(buf, n + offset) 19 return o 20end 21function Stat_mt:Init(buf, pos) 22 self.view = flatbuffers.view.New(buf, pos) 23end 24function Stat_mt:Id() 25 local o = self.view:Offset(4) 26 if o ~= 0 then 27 return self.view:String(o + self.view.pos) 28 end 29end 30function Stat_mt:Val() 31 local o = self.view:Offset(6) 32 if o ~= 0 then 33 return self.view:Get(flatbuffers.N.Int64, o + self.view.pos) 34 end 35 return 0 36end 37function Stat_mt:Count() 38 local o = self.view:Offset(8) 39 if o ~= 0 then 40 return self.view:Get(flatbuffers.N.Uint16, o + self.view.pos) 41 end 42 return 0 43end 44function Stat.Start(builder) builder:StartObject(3) end 45function Stat.AddId(builder, id) builder:PrependUOffsetTRelativeSlot(0, id, 0) end 46function Stat.AddVal(builder, val) builder:PrependInt64Slot(1, val, 0) end 47function Stat.AddCount(builder, count) builder:PrependUint16Slot(2, count, 0) end 48function Stat.End(builder) return builder:EndObject() end 49 50return Stat -- return the module