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

Method newClosure

stack.go:224–235  ·  view source on GitHub ↗
(p *prototype, upValues []*upValue, base int)

Source from the content-addressed store, hash-verified

222}
223
224func (l *State) newClosure(p *prototype, upValues []*upValue, base int) value {
225 c := l.newLuaClosure(p)
226 p.cache = c
227 for i, uv := range p.upValues {
228 if uv.isLocal { // upValue refers to local variable
229 c.upValues[i] = l.findUpValue(base + uv.index)
230 } else { // get upValue from enclosing function
231 c.upValues[i] = upValues[uv.index]
232 }
233 }
234 return c
235}
236
237func cached(p *prototype, upValues []*upValue, base int) *luaClosure {
238 c := p.cache

Callers 2

executeSwitchMethod · 0.95
initFunction · 0.80

Calls 2

newLuaClosureMethod · 0.95
findUpValueMethod · 0.95

Tested by

no test coverage detected