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

Method NewClosure

_state.go:1429–1437  ·  view source on GitHub ↗
(fn LGFunction, upvalues ...LValue)

Source from the content-addressed store, hash-verified

1427}
1428
1429func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction {
1430 cl := newLFunctionG(fn, ls.currentEnv(), len(upvalues))
1431 for i, lv := range upvalues {
1432 cl.Upvalues[i] = &Upvalue{}
1433 cl.Upvalues[i].Close()
1434 cl.Upvalues[i].SetValue(lv)
1435 }
1436 return cl
1437}
1438
1439/* }}} */
1440

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected