1+ --[[ flatbuffers.goldens.Universe
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: 25.9.23
7+
8+ Declared by : //basic.fbs
9+ Rooting type : flatbuffers.goldens.Universe (//basic.fbs)
10+
11+ --]]
12+
13+ local __flatbuffers_goldens_Galaxy = require (' flatbuffers.goldens.Galaxy' )
14+ local flatbuffers = require (' flatbuffers' )
15+
16+ local Universe = {}
17+ local mt = {}
18+
19+ function Universe .New ()
20+ local o = {}
21+ setmetatable (o , {__index = mt })
22+ return o
23+ end
24+
25+ function Universe .GetRootAsUniverse (buf , offset )
26+ if type (buf ) == " string" then
27+ buf = flatbuffers .binaryArray .New (buf )
28+ end
29+
30+ local n = flatbuffers .N .UOffsetT :Unpack (buf , offset )
31+ local o = Universe .New ()
32+ o :Init (buf , n + offset )
33+ return o
34+ end
35+
36+ function mt :Init (buf , pos )
37+ self .view = flatbuffers .view .New (buf , pos )
38+ end
39+
40+ function mt :Age ()
41+ local o = self .view :Offset (4 )
42+ if o ~= 0 then
43+ return self .view :Get (flatbuffers .N .Float64 , self .view .pos + o )
44+ end
45+ return 0.0
46+ end
47+
48+ function mt :Galaxies (j )
49+ local o = self .view :Offset (6 )
50+ if o ~= 0 then
51+ local x = self .view :Vector (o )
52+ x = x + ((j - 1 ) * 4 )
53+ x = self .view :Indirect (x )
54+ local obj = __flatbuffers_goldens_Galaxy .New ()
55+ obj :Init (self .view .bytes , x )
56+ return obj
57+ end
58+ end
59+
60+ function mt :GalaxiesLength ()
61+ local o = self .view :Offset (6 )
62+ if o ~= 0 then
63+ return self .view :VectorLen (o )
64+ end
65+ return 0
66+ end
67+
68+ function Universe .Start (builder )
69+ builder :StartObject (2 )
70+ end
71+
72+ function Universe .AddAge (builder , age )
73+ builder :PrependFloat64Slot (0 , age , 0.0 )
74+ end
75+
76+ function Universe .AddGalaxies (builder , galaxies )
77+ builder :PrependUOffsetTRelativeSlot (1 , galaxies , 0 )
78+ end
79+
80+ function Universe .StartGalaxiesVector (builder , numElems )
81+ return builder :StartVector (4 , numElems , 4 )
82+ end
83+
84+ function Universe .End (builder )
85+ return builder :EndObject ()
86+ end
87+
88+ return Universe
0 commit comments