Lua (5.3) Language addition (#4804)
[platform/upstream/flatbuffers.git] / samples / lua / MyGame / Sample / Vec3.lua
1 -- automatically generated by the FlatBuffers compiler, do not modify
2
3 -- namespace: Sample
4
5 local flatbuffers = require('flatbuffers')
6
7 local Vec3 = {} -- the module
8 local Vec3_mt = {} -- the class metatable
9
10 function Vec3.New()
11     local o = {}
12     setmetatable(o, {__index = Vec3_mt})
13     return o
14 end
15 function Vec3_mt:Init(buf, pos)
16     self.view = flatbuffers.view.New(buf, pos)
17 end
18 function Vec3_mt:X()
19     return self.view:Get(flatbuffers.N.Float32, self.view.pos + 0)
20 end
21 function Vec3_mt:Y()
22     return self.view:Get(flatbuffers.N.Float32, self.view.pos + 4)
23 end
24 function Vec3_mt:Z()
25     return self.view:Get(flatbuffers.N.Float32, self.view.pos + 8)
26 end
27 function Vec3.CreateVec3(builder, x, y, z)
28     builder:Prep(4, 12)
29     builder:PrependFloat32(z)
30     builder:PrependFloat32(y)
31     builder:PrependFloat32(x)
32     return builder:Offset()
33 end
34
35 return Vec3 -- return the module