"Fossies" - the Fresh Open Source Software Archive

Member "flatbuffers-23.1.21/tests/MyGame/Example/Ability.lua" (21 Jan 2023, 872 Bytes) of package /linux/misc/flatbuffers-23.1.21.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Ability.lua": 23.1.20_vs_23.1.21.

    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: 23.1.21
    7 
    8   Declared by  : //monster_test.fbs
    9   Rooting type : MyGame.Example.Monster (//monster_test.fbs)
   10 
   11 --]]
   12 
   13 local flatbuffers = require('flatbuffers')
   14 
   15 local Ability = {}
   16 local mt = {}
   17 
   18 function Ability.New()
   19   local o = {}
   20   setmetatable(o, {__index = mt})
   21   return o
   22 end
   23 
   24 function mt:Init(buf, pos)
   25   self.view = flatbuffers.view.New(buf, pos)
   26 end
   27 
   28 function mt:Id()
   29   return self.view:Get(flatbuffers.N.Uint32, self.view.pos + 0)
   30 end
   31 
   32 function mt:Distance()
   33   return self.view:Get(flatbuffers.N.Uint32, self.view.pos + 4)
   34 end
   35 
   36 function Ability.CreateAbility(builder, id, distance)
   37   builder:Prep(4, 8)
   38   builder:PrependUint32(distance)
   39   builder:PrependUint32(id)
   40   return builder:Offset()
   41 end
   42 
   43 return Ability