James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 1 | --[[ MyGame.Example.Stat |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 2 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 3 | Automatically generated by the FlatBuffers compiler, do not modify. |
| 4 | Or modify. I'm a message, not a cop. |
| 5 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 6 | flatc version: 22.10.26 |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 7 | |
| 8 | Declared by : //monster_test.fbs |
| 9 | Rooting type : MyGame.Example.Monster (//monster_test.fbs) |
| 10 | |
| 11 | --]] |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 12 | |
| 13 | local flatbuffers = require('flatbuffers') |
| 14 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 15 | local Stat = {} |
| 16 | local mt = {} |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 17 | |
| 18 | function Stat.New() |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 19 | local o = {} |
| 20 | setmetatable(o, {__index = mt}) |
| 21 | return o |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 22 | end |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 23 | |
James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame] | 24 | function mt:Init(buf, pos) |
| 25 | self.view = flatbuffers.view.New(buf, pos) |
| 26 | end |
| 27 | |
| 28 | function mt:Id() |
| 29 | local o = self.view:Offset(4) |
| 30 | if o ~= 0 then |
| 31 | return self.view:String(self.view.pos + o) |
| 32 | end |
| 33 | end |
| 34 | |
| 35 | function mt:Val() |
| 36 | local o = self.view:Offset(6) |
| 37 | if o ~= 0 then |
| 38 | return self.view:Get(flatbuffers.N.Int64, self.view.pos + o) |
| 39 | end |
| 40 | return 0 |
| 41 | end |
| 42 | |
| 43 | function mt:Count() |
| 44 | local o = self.view:Offset(8) |
| 45 | if o ~= 0 then |
| 46 | return self.view:Get(flatbuffers.N.Uint16, self.view.pos + o) |
| 47 | end |
| 48 | return 0 |
| 49 | end |
| 50 | |
| 51 | function Stat.Start(builder) |
| 52 | builder:StartObject(3) |
| 53 | end |
| 54 | |
| 55 | function Stat.AddId(builder, id) |
| 56 | builder:PrependUOffsetTRelativeSlot(0, id, 0) |
| 57 | end |
| 58 | |
| 59 | function Stat.AddVal(builder, val) |
| 60 | builder:PrependInt64Slot(1, val, 0) |
| 61 | end |
| 62 | |
| 63 | function Stat.AddCount(builder, count) |
| 64 | builder:PrependUint16Slot(2, count, 0) |
| 65 | end |
| 66 | |
| 67 | function Stat.End(builder) |
| 68 | return builder:EndObject() |
| 69 | end |
| 70 | |
| 71 | return Stat |