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

Function UpValueId

lua.go:1303–1311  ·  view source on GitHub ↗

UpValueId returns a unique identifier for the upvalue numbered n from the closure at index f. Parameters f and n are as in UpValue (but n cannot be greater than the number of upvalues). These unique identifiers allow a program to check whether different closures share upvalues. Lua closures that sh

(l *State, f, n int)

Source from the content-addressed store, hash-verified

1301// access a same external local variable) will return identical ids for those
1302// upvalue indices.
1303func UpValueId(l *State, f, n int) interface{} {
1304 switch fun := l.indexToValue(f).(type) {
1305 case *luaClosure:
1306 return *l.upValue(f, n)
1307 case *goClosure:
1308 return &fun.upValues[n-1]
1309 }
1310 panic("closure expected")
1311}
1312
1313// UpValueJoin makes the n1-th upvalue of the Lua closure at index f1 refer to
1314// the n2-th upvalue of the Lua closure at index f2.

Callers 1

debug.goFile · 0.85

Calls 2

indexToValueMethod · 0.80
upValueMethod · 0.65

Tested by

no test coverage detected