...
1--[[ MyGame.Example.Stat
2
3 Automatically generated by the FlatBuffers compiler, do not modify.
4 Or modify. I'm a message, not a cop.
5
6 flatc version: 23.5.26
7
8 Declared by : //monster_test.fbs
9 Rooting type : MyGame.Example.Monster (//monster_test.fbs)
10
11--]]
12
13local flatbuffers = require('flatbuffers')
14
15local Stat = {}
16local mt = {}
17
18function Stat.New()
19 local o = {}
20 setmetatable(o, {__index = mt})
21 return o
22end
23
24function 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
View as plain text