MCPcopy Index your code
hub / github.com/yuin/gopher-lua / NewClosure

Method NewClosure

state.go:1642–1650  ·  view source on GitHub ↗
(fn LGFunction, upvalues ...LValue)

Source from the content-addressed store, hash-verified

1640}
1641
1642func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction {
1643 cl := newLFunctionG(fn, ls.currentEnv(), len(upvalues))
1644 for i, lv := range upvalues {
1645 cl.Upvalues[i] = &Upvalue{}
1646 cl.Upvalues[i].Close()
1647 cl.Upvalues[i].SetValue(lv)
1648 }
1649 return cl
1650}
1651
1652/* }}} */
1653

Callers 8

SetFuncsMethod · 0.95
OpenBaseFunction · 0.45
OpenIoFunction · 0.45
fileLinesFunction · 0.45
ioLinesFunction · 0.45
OpenStringFunction · 0.45
coWrapFunction · 0.45
TestGetAndReplaceFunction · 0.45

Calls 4

currentEnvMethod · 0.95
newLFunctionGFunction · 0.85
SetValueMethod · 0.80
CloseMethod · 0.45

Tested by 1

TestGetAndReplaceFunction · 0.36