• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1-- automatically generated by the FlatBuffers compiler, do not modify
2
3-- namespace: Example
4
5local flatbuffers = require('flatbuffers')
6
7local TestSimpleTableWithEnum = {} -- the module
8local TestSimpleTableWithEnum_mt = {} -- the class metatable
9
10function TestSimpleTableWithEnum.New()
11    local o = {}
12    setmetatable(o, {__index = TestSimpleTableWithEnum_mt})
13    return o
14end
15function TestSimpleTableWithEnum.GetRootAsTestSimpleTableWithEnum(buf, offset)
16    if type(buf) == "string" then
17        buf = flatbuffers.binaryArray.New(buf)
18    end
19    local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)
20    local o = TestSimpleTableWithEnum.New()
21    o:Init(buf, n + offset)
22    return o
23end
24function TestSimpleTableWithEnum_mt:Init(buf, pos)
25    self.view = flatbuffers.view.New(buf, pos)
26end
27function TestSimpleTableWithEnum_mt:Color()
28    local o = self.view:Offset(4)
29    if o ~= 0 then
30        return self.view:Get(flatbuffers.N.Uint8, o + self.view.pos)
31    end
32    return 2
33end
34function TestSimpleTableWithEnum.Start(builder) builder:StartObject(1) end
35function TestSimpleTableWithEnum.AddColor(builder, color) builder:PrependUint8Slot(0, color, 2) end
36function TestSimpleTableWithEnum.End(builder) return builder:EndObject() end
37
38return TestSimpleTableWithEnum -- return the module