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

Function UpValue

lua.go:1258–1268  ·  view source on GitHub ↗

UpValue returns the name of the upvalue at index away from function, where index cannot be greater than the number of upvalues. Returns an empty string and false if the index is greater than the number of upvalues.

(l *State, function, index int)

Source from the content-addressed store, hash-verified

1256// Returns an empty string and false if the index is greater than the number
1257// of upvalues.
1258func UpValue(l *State, function, index int) (name string, ok bool) {
1259 if c, isClosure := l.indexToValue(function).(closure); isClosure {
1260 if ok = 1 <= index && index <= c.upValueCount(); ok {
1261 if c, isLua := c.(*luaClosure); isLua {
1262 name = c.prototype.upValues[index-1].name
1263 }
1264 l.apiPush(c.upValue(index - 1))
1265 }
1266 }
1267 return
1268}
1269
1270// SetUpValue sets the value of a closure's upvalue. It assigns the value at
1271// the top of the stack to the upvalue and returns its name. It also pops a

Callers

nothing calls this directly

Calls 4

indexToValueMethod · 0.80
apiPushMethod · 0.80
upValueCountMethod · 0.65
upValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…