(name, mode string)
| 59 | } |
| 60 | |
| 61 | func ioFileHelper(name, mode string) Function { |
| 62 | return func(l *State) int { |
| 63 | if !l.IsNoneOrNil(1) { |
| 64 | if name, ok := l.ToString(1); ok { |
| 65 | forceOpen(l, name, mode) |
| 66 | } else { |
| 67 | toFile(l) |
| 68 | l.PushValue(1) |
| 69 | } |
| 70 | l.SetField(RegistryIndex, name) |
| 71 | } |
| 72 | l.Field(RegistryIndex, name) |
| 73 | return 1 |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func closeHelper(l *State) int { |
| 78 | s := toStream(l) |