1-- automatically generated by the FlatBuffers compiler, do not modify 2 3-- namespace: Example 4 5local flatbuffers = require('flatbuffers') 6 7local Vec3 = {} -- the module 8local Vec3_mt = {} -- the class metatable 9 10function Vec3.New() 11 local o = {} 12 setmetatable(o, {__index = Vec3_mt}) 13 return o 14end 15function Vec3_mt:Init(buf, pos) 16 self.view = flatbuffers.view.New(buf, pos) 17end 18function Vec3_mt:X() 19 return self.view:Get(flatbuffers.N.Float32, self.view.pos + 0) 20end 21function Vec3_mt:Y() 22 return self.view:Get(flatbuffers.N.Float32, self.view.pos + 4) 23end 24function Vec3_mt:Z() 25 return self.view:Get(flatbuffers.N.Float32, self.view.pos + 8) 26end 27function Vec3_mt:Test1() 28 return self.view:Get(flatbuffers.N.Float64, self.view.pos + 16) 29end 30function Vec3_mt:Test2() 31 return self.view:Get(flatbuffers.N.Uint8, self.view.pos + 24) 32end 33function Vec3_mt:Test3(obj) 34 obj:Init(self.view.bytes, self.view.pos + 26) 35 return obj 36end 37function Vec3.CreateVec3(builder, x, y, z, test1, test2, test3_a, test3_b) 38 builder:Prep(8, 32) 39 builder:Pad(2) 40 builder:Prep(2, 4) 41 builder:Pad(1) 42 builder:PrependInt8(test3_b) 43 builder:PrependInt16(test3_a) 44 builder:Pad(1) 45 builder:PrependUint8(test2) 46 builder:PrependFloat64(test1) 47 builder:Pad(4) 48 builder:PrependFloat32(z) 49 builder:PrependFloat32(y) 50 builder:PrependFloat32(x) 51 return builder:Offset() 52end 53 54return Vec3 -- return the module