(p *prototype, upValues []*upValue, base int)
| 222 | } |
| 223 | |
| 224 | func (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 | |
| 237 | func cached(p *prototype, upValues []*upValue, base int) *luaClosure { |
| 238 | c := p.cache |
no test coverage detected