...
1--[[ MyGame.Example.Vec3
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 Vec3 = {}
16local mt = {}
17
18function Vec3.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:X()
29 return self.view:Get(flatbuffers.N.Float32, self.view.pos + 0)
30end
31
32function mt:Y()
33 return self.view:Get(flatbuffers.N.Float32, self.view.pos + 4)
34end
35
36function mt:Z()
37 return self.view:Get(flatbuffers.N.Float32, self.view.pos + 8)
38end
39
40function mt:Test1()
41 return self.view:Get(flatbuffers.N.Float64, self.view.pos + 16)
42end
43
44function mt:Test2()
45 return self.view:Get(flatbuffers.N.Uint8, self.view.pos + 24)
46end
47
48function mt:Test3(obj)
49 obj:Init(self.view.bytes, self.view.pos + 26)
50 return obj
51end
52
53function Vec3.CreateVec3(builder, x, y, z, test1, test2, test3_a, test3_b)
54 builder:Prep(8, 32)
55 builder:Pad(2)
56 builder:Prep(2, 4)
57 builder:Pad(1)
58 builder:PrependInt8(test3_b)
59 builder:PrependInt16(test3_a)
60 builder:Pad(1)
61 builder:PrependUint8(test2)
62 builder:PrependFloat64(test1)
63 builder:Pad(4)
64 builder:PrependFloat32(z)
65 builder:PrependFloat32(y)
66 builder:PrependFloat32(x)
67 return builder:Offset()
68end
69
70return Vec3
View as plain text