"Fossies" - the Fresh Open Source Software Archive

Member "flatbuffers-23.1.21/tests/MyGame/Example/Ability.nim" (21 Jan 2023, 816 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) Nim source code syntax highlighting (style: standard) with prefixed line numbers. 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.nim": 23.1.20_vs_23.1.21.

    1 #[ MyGame.Example.Ability
    2   Automatically generated by the FlatBuffers compiler, do not modify.
    3   Or modify. I'm a message, not a cop.
    4 
    5   flatc version: 23.1.21
    6 
    7   Declared by  : 
    8   Rooting type : MyGame.Example.Monster ()
    9 ]#
   10 
   11 import flatbuffers
   12 
   13 type Ability* = object of FlatObj
   14 func id*(self: Ability): uint32 =
   15   return Get[uint32](self.tab, self.tab.Pos + 0)
   16 func `id=`*(self: var Ability, n: uint32): bool =
   17   return self.tab.Mutate(self.tab.Pos + 0, n)
   18 func distance*(self: Ability): uint32 =
   19   return Get[uint32](self.tab, self.tab.Pos + 4)
   20 func `distance=`*(self: var Ability, n: uint32): bool =
   21   return self.tab.Mutate(self.tab.Pos + 4, n)
   22 proc AbilityCreate*(self: var Builder, id: uint32, distance: uint32): uoffset =
   23   self.Prep(4, 8)
   24   self.Prepend(distance)
   25   self.Prepend(id)
   26   return self.Offset()