MCPcopy Index your code
hub / github.com/Shopify/go-lua / readConstants

Method readConstants

undump.go:167–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165}
166
167func (state *loadState) readConstants() (constants []value, prototypes []prototype, err error) {
168 var n int32
169 if n, err = state.readInt(); err != nil || n == 0 {
170 return
171 }
172
173 constants = make([]value, n)
174 for i := range constants {
175 var t byte
176 switch t, err = state.readByte(); {
177 case err != nil:
178 return
179 case t == byte(TypeNil):
180 constants[i] = nil
181 case t == byte(TypeBoolean):
182 constants[i], err = state.readBool()
183 case t == byte(TypeNumber):
184 constants[i], err = state.readNumber()
185 case t == byte(TypeString):
186 constants[i], err = state.readString()
187 default:
188 err = errUnknownConstantType
189 }
190 if err != nil {
191 return
192 }
193 }
194 return
195}
196
197func (state *loadState) readPrototypes() (prototypes []prototype, err error) {
198 var n int32

Callers 1

readFunctionMethod · 0.95

Calls 5

readIntMethod · 0.95
readByteMethod · 0.95
readBoolMethod · 0.95
readNumberMethod · 0.95
readStringMethod · 0.95

Tested by

no test coverage detected