1--[[ MyGame.Example.TypeAliases
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 TypeAliases = {}
16local mt = {}
17
18function TypeAliases.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:I8()
29 local o = self.view:Offset(4)
30 if o ~= 0 then
31 return self.view:Get(flatbuffers.N.Int8, self.view.pos + o)
32 end
33 return 0
34end
35
36function mt:U8()
37 local o = self.view:Offset(6)
38 if o ~= 0 then
39 return self.view:Get(flatbuffers.N.Uint8, self.view.pos + o)
40 end
41 return 0
42end
43
44function mt:I16()
45 local o = self.view:Offset(8)
46 if o ~= 0 then
47 return self.view:Get(flatbuffers.N.Int16, self.view.pos + o)
48 end
49 return 0
50end
51
52function mt:U16()
53 local o = self.view:Offset(10)
54 if o ~= 0 then
55 return self.view:Get(flatbuffers.N.Uint16, self.view.pos + o)
56 end
57 return 0
58end
59
60function mt:I32()
61 local o = self.view:Offset(12)
62 if o ~= 0 then
63 return self.view:Get(flatbuffers.N.Int32, self.view.pos + o)
64 end
65 return 0
66end
67
68function mt:U32()
69 local o = self.view:Offset(14)
70 if o ~= 0 then
71 return self.view:Get(flatbuffers.N.Uint32, self.view.pos + o)
72 end
73 return 0
74end
75
76function mt:I64()
77 local o = self.view:Offset(16)
78 if o ~= 0 then
79 return self.view:Get(flatbuffers.N.Int64, self.view.pos + o)
80 end
81 return 0
82end
83
84function mt:U64()
85 local o = self.view:Offset(18)
86 if o ~= 0 then
87 return self.view:Get(flatbuffers.N.Uint64, self.view.pos + o)
88 end
89 return 0
90end
91
92function mt:F32()
93 local o = self.view:Offset(20)
94 if o ~= 0 then
95 return self.view:Get(flatbuffers.N.Float32, self.view.pos + o)
96 end
97 return 0.0
98end
99
100function mt:F64()
101 local o = self.view:Offset(22)
102 if o ~= 0 then
103 return self.view:Get(flatbuffers.N.Float64, self.view.pos + o)
104 end
105 return 0.0
106end
107
108function mt:V8(j)
109 local o = self.view:Offset(24)
110 if o ~= 0 then
111 local a = self.view:Vector(o)
112 return self.view:Get(flatbuffers.N.Int8, a + ((j-1) * 1))
113 end
114 return 0
115end
116
117function mt:V8AsString(start, stop)
118 return self.view:VectorAsString(24, start, stop)
119end
120
121function mt:V8Length()
122 local o = self.view:Offset(24)
123 if o ~= 0 then
124 return self.view:VectorLen(o)
125 end
126 return 0
127end
128
129function mt:Vf64(j)
130 local o = self.view:Offset(26)
131 if o ~= 0 then
132 local a = self.view:Vector(o)
133 return self.view:Get(flatbuffers.N.Float64, a + ((j-1) * 8))
134 end
135 return 0
136end
137
138function mt:Vf64Length()
139 local o = self.view:Offset(26)
140 if o ~= 0 then
141 return self.view:VectorLen(o)
142 end
143 return 0
144end
145
146function TypeAliases.Start(builder)
147 builder:StartObject(12)
148end
149
150function TypeAliases.AddI8(builder, i8)
151 builder:PrependInt8Slot(0, i8, 0)
152end
153
154function TypeAliases.AddU8(builder, u8)
155 builder:PrependUint8Slot(1, u8, 0)
156end
157
158function TypeAliases.AddI16(builder, i16)
159 builder:PrependInt16Slot(2, i16, 0)
160end
161
162function TypeAliases.AddU16(builder, u16)
163 builder:PrependUint16Slot(3, u16, 0)
164end
165
166function TypeAliases.AddI32(builder, i32)
167 builder:PrependInt32Slot(4, i32, 0)
168end
169
170function TypeAliases.AddU32(builder, u32)
171 builder:PrependUint32Slot(5, u32, 0)
172end
173
174function TypeAliases.AddI64(builder, i64)
175 builder:PrependInt64Slot(6, i64, 0)
176end
177
178function TypeAliases.AddU64(builder, u64)
179 builder:PrependUint64Slot(7, u64, 0)
180end
181
182function TypeAliases.AddF32(builder, f32)
183 builder:PrependFloat32Slot(8, f32, 0.0)
184end
185
186function TypeAliases.AddF64(builder, f64)
187 builder:PrependFloat64Slot(9, f64, 0.0)
188end
189
190function TypeAliases.AddV8(builder, v8)
191 builder:PrependUOffsetTRelativeSlot(10, v8, 0)
192end
193
194function TypeAliases.StartV8Vector(builder, numElems)
195 return builder:StartVector(1, numElems, 1)
196end
197
198function TypeAliases.AddVf64(builder, vf64)
199 builder:PrependUOffsetTRelativeSlot(11, vf64, 0)
200end
201
202function TypeAliases.StartVf64Vector(builder, numElems)
203 return builder:StartVector(8, numElems, 8)
204end
205
206function TypeAliases.End(builder)
207 return builder:EndObject()
208end
209
210return TypeAliases
View as plain text