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)
| 1301 | // access a same external local variable) will return identical ids for those |
| 1302 | // upvalue indices. |
| 1303 | func 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. |
no test coverage detected