iolib

package
v0.0.0-...-e0b5347 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferedStdFiles bool = true

BufferedStdFiles sets wether std files should be buffered

View Source
var LibLoader = packagelib.Loader{
	Load: load,
	Name: "io",
}

LibLoader can load the io lib.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

A File wraps an os.File for manipulation by iolib.

func FileArg

func FileArg(c *rt.GoCont, n int) (*File, error)

FileArg turns a continuation argument into a *File.

func NewFile

func NewFile(file *os.File, options int) *File

NewFile returns a new *File from an *os.File.

func OpenFile

func OpenFile(r *rt.Runtime, name, mode string) (*File, error)

OpenFile opens a file with the given name in the given lua mode.

func TempFile

func TempFile(r *rt.Runtime) (*File, error)

TempFile tries to make a temporary file, and if successful schedules the file to be removed when the process dies.

func ValueToFile

func ValueToFile(v rt.Value) (*File, bool)

ValueToFile turns a lua value to a *File if possible.

func (*File) Close

func (f *File) Close() error

Close attempts to close the file, returns an error if not successful.

func (*File) Flush

func (f *File) Flush() error

Flush attempts to sync the file, returns an error if a problem occurs.

func (*File) IsClosable

func (f *File) IsClosable() bool

func (*File) IsClosed

func (f *File) IsClosed() bool

IsClosed returns true if the file is closed.

func (*File) IsTemp

func (f *File) IsTemp() bool

IsTemp returns true if the file is temporary.

func (*File) Name

func (f *File) Name() string

Name returns the file name.

func (*File) Read

func (f *File) Read(n int) (rt.Value, error)

Read return a lua string made of up to n bytes.

func (*File) ReadAll

func (f *File) ReadAll() (rt.Value, error)

ReadAll attempts to read the whole file and return a lua string containing it.

func (*File) ReadLine

func (f *File) ReadLine(withEnd bool) (rt.Value, error)

ReadLine reads a line from the file. If withEnd is true, it will include the end of the line in the returned value.

func (*File) ReadNumber

func (f *File) ReadNumber() (rt.Value, error)

ReadNumber tries to read a number from the file.

func (*File) ReleaseResources

func (f *File) ReleaseResources(d *rt.UserData)

ReleaseResources cleans up the file

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (n int64, err error)

Seek seeks from the file.

func (*File) SetWriteBuffer

func (f *File) SetWriteBuffer(mode string, size int) error

func (*File) WriteString

func (f *File) WriteString(s string) error

WriteString writes a string to the file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL