James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 1 | #[ MyGame.Example.Stat |
| 2 | Automatically generated by the FlatBuffers compiler, do not modify. |
| 3 | Or modify. I'm a message, not a cop. |
| 4 | |
| 5 | flatc version: 22.10.26 |
| 6 | |
| 7 | Declared by : |
| 8 | Rooting type : MyGame.Example.Monster () |
| 9 | ]# |
| 10 | |
| 11 | import flatbuffers |
| 12 | import std/options |
| 13 | |
| 14 | type Stat* = object of FlatObj |
| 15 | func id*(self: Stat): Option[string] = |
| 16 | let o = self.tab.Offset(4) |
| 17 | if o != 0: |
| 18 | return some(self.tab.String(self.tab.Pos + o)) |
| 19 | func val*(self: Stat): int64 = |
| 20 | let o = self.tab.Offset(6) |
| 21 | if o != 0: |
| 22 | return Get[int64](self.tab, self.tab.Pos + o) |
| 23 | return 0 |
| 24 | func `val=`*(self: var Stat, n: int64): bool = |
| 25 | return self.tab.MutateSlot(6, n) |
| 26 | func count*(self: Stat): uint16 = |
| 27 | let o = self.tab.Offset(8) |
| 28 | if o != 0: |
| 29 | return Get[uint16](self.tab, self.tab.Pos + o) |
| 30 | return 0 |
| 31 | func `count=`*(self: var Stat, n: uint16): bool = |
| 32 | return self.tab.MutateSlot(8, n) |
| 33 | proc StatStart*(builder: var Builder) = |
| 34 | builder.StartObject(3) |
| 35 | proc StatAddid*(builder: var Builder, id: uoffset) = |
| 36 | builder.PrependSlot(0, id, default(uoffset)) |
| 37 | proc StatAddval*(builder: var Builder, val: int64) = |
| 38 | builder.PrependSlot(1, val, default(int64)) |
| 39 | proc StatAddcount*(builder: var Builder, count: uint16) = |
| 40 | builder.PrependSlot(2, count, default(uint16)) |
| 41 | proc StatEnd*(builder: var Builder): uoffset = |
| 42 | return builder.EndObject() |