(l *State, functions []RegistryFunction, upValueCount uint8)
| 379 | func TypeNameOf(l *State, index int) string { return l.TypeOf(index).String() } |
| 380 | |
| 381 | func SetFunctions(l *State, functions []RegistryFunction, upValueCount uint8) { |
| 382 | uvCount := int(upValueCount) |
| 383 | CheckStackWithMessage(l, uvCount, "too many upvalues") |
| 384 | for _, r := range functions { // fill the table with given functions |
| 385 | for i := 0; i < uvCount; i++ { // copy upvalues to the top |
| 386 | l.PushValue(-uvCount) |
| 387 | } |
| 388 | l.PushGoClosure(r.Function, upValueCount) // closure with those upvalues |
| 389 | l.SetField(-(uvCount + 2), r.Name) |
| 390 | } |
| 391 | l.Pop(uvCount) // remove upvalues |
| 392 | } |
| 393 | |
| 394 | func CheckStackWithMessage(l *State, space int, message string) { |
| 395 | // keep some extra space to run error routines, if needed |
no test coverage detected