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)
| 1256 | // Returns an empty string and false if the index is greater than the number |
| 1257 | // of upvalues. |
| 1258 | func 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…