xref: /aosp_15_r20/external/flatbuffers/tests/MyGame/Example/Ability.lua (revision 890232f25432b36107d06881e0a25aaa6b473652)
1--[[ MyGame.Example.Ability
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: 2.0.7
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 Ability = {}
16local mt = {}
17
18function Ability.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  return self.view:Get(flatbuffers.N.Uint32, self.view.pos + 0)
30end
31
32function mt:Distance()
33  return self.view:Get(flatbuffers.N.Uint32, self.view.pos + 4)
34end
35
36function Ability.CreateAbility(builder, id, distance)
37  builder:Prep(4, 8)
38  builder:PrependUint32(distance)
39  builder:PrependUint32(id)
40  return builder:Offset()
41end
42
43return Ability