| 419 | } |
| 420 | |
| 421 | func SubTable(l *State, index int, name string) bool { |
| 422 | l.Field(index, name) |
| 423 | if l.IsTable(-1) { |
| 424 | return true // table already there |
| 425 | } |
| 426 | l.Pop(1) // remove previous result |
| 427 | index = l.AbsIndex(index) |
| 428 | l.NewTable() |
| 429 | l.PushValue(-1) // copy to be left at top |
| 430 | l.SetField(index, name) // assign new table to field |
| 431 | return false // did not find table there |
| 432 | } |
| 433 | |
| 434 | // Require calls function f with string name as an argument and sets the call |
| 435 | // result in package.loaded[name], as if that function had been called |