blob: a9848aa41c59f8640a44dd4ed35f6e36d5c40b88 [file] [log] [blame]
James Kuszmaul8e62b022022-03-22 09:33:25 -07001--[[ MyGame.Example.Stat
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002
James Kuszmaul8e62b022022-03-22 09:33:25 -07003 Automatically generated by the FlatBuffers compiler, do not modify.
4 Or modify. I'm a message, not a cop.
5
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08006 flatc version: 22.10.26
James Kuszmaul8e62b022022-03-22 09:33:25 -07007
8 Declared by : //monster_test.fbs
9 Rooting type : MyGame.Example.Monster (//monster_test.fbs)
10
11--]]
Austin Schuhe89fa2d2019-08-14 20:24:23 -070012
13local flatbuffers = require('flatbuffers')
14
James Kuszmaul8e62b022022-03-22 09:33:25 -070015local Stat = {}
16local mt = {}
Austin Schuhe89fa2d2019-08-14 20:24:23 -070017
18function Stat.New()
James Kuszmaul8e62b022022-03-22 09:33:25 -070019 local o = {}
20 setmetatable(o, {__index = mt})
21 return o
Austin Schuhe89fa2d2019-08-14 20:24:23 -070022end
Austin Schuhe89fa2d2019-08-14 20:24:23 -070023
James Kuszmaul8e62b022022-03-22 09:33:25 -070024function mt:Init(buf, pos)
25 self.view = flatbuffers.view.New(buf, pos)
26end
27
28function mt:Id()
29 local o = self.view:Offset(4)
30 if o ~= 0 then
31 return self.view:String(self.view.pos + o)
32 end
33end
34
35function mt:Val()
36 local o = self.view:Offset(6)
37 if o ~= 0 then
38 return self.view:Get(flatbuffers.N.Int64, self.view.pos + o)
39 end
40 return 0
41end
42
43function mt:Count()
44 local o = self.view:Offset(8)
45 if o ~= 0 then
46 return self.view:Get(flatbuffers.N.Uint16, self.view.pos + o)
47 end
48 return 0
49end
50
51function Stat.Start(builder)
52 builder:StartObject(3)
53end
54
55function Stat.AddId(builder, id)
56 builder:PrependUOffsetTRelativeSlot(0, id, 0)
57end
58
59function Stat.AddVal(builder, val)
60 builder:PrependInt64Slot(1, val, 0)
61end
62
63function Stat.AddCount(builder, count)
64 builder:PrependUint16Slot(2, count, 0)
65end
66
67function Stat.End(builder)
68 return builder:EndObject()
69end
70
71return Stat