Documentation
¶
Overview ¶
package types holds type definitions used for interfacing with the Litecode VM.
Index ¶
- func DecodeArgs[T ProgramArgs](encoded []byte) (args T, err error)
- func DecodeRets[T ProgramRets](encoded []byte) (args T, err error)
- type Buffer
- type Compiler
- type Coroutine
- type Env
- type Function
- type ProgramArgs
- type ProgramRets
- type ProgramType
- type Table
- type TestArgs
- type TestRets
- type Val
- type Vector
- type WebArgs
- type WebArgsUrl
- type WebRets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeArgs ¶
func DecodeArgs[T ProgramArgs](encoded []byte) (args T, err error)
func DecodeRets ¶
func DecodeRets[T ProgramRets](encoded []byte) (args T, err error)
Types ¶
type Buffer ¶
type Buffer []byte
Buffer represents a Luau byte buffer. Luau type`buffer` As buffers are compared by reference, this type must always be used as a pointer.
type Compiler ¶
Compiler allows programs to be compiled and deserialised with a cache and given optimisation level.
type Coroutine ¶
type Coroutine struct {
Function
Env
Filepath, Dbgpath string // actually does well here
RequireHistory []string // prevents cyclic module dependencies
YieldChan chan internal.Yield
ResumeChan chan []Val
Dbg debugging
Compiler // for require()
internal.Status
ProgramArgs // idk how
}
Coroutine represents a Luau coroutine, including the main coroutine. Luau type `thread` As coroutines are compared by reference, this type must always be used as a pointer.
type Function ¶
type Function struct {
// Run is the native body of the function. Its coroutine argument is used to run the function in a coroutine.
Run *func(*Coroutine, ...Val) ([]Val, error)
Name string
Co *Coroutine // if in a different coroutine
}
Function represents a native or wrapped Luau function. Luau type `function`
type ProgramArgs ¶
type ProgramArgs interface {
Type() ProgramType
Encode() []byte
}
ProgramArgs represents the arguments passed to a program.
type ProgramRets ¶
type ProgramRets interface {
// Equal(ProgramRets) error
Type() ProgramType
Encode() []byte
}
ProgramRets represents the response returned from a program.
type ProgramType ¶
type ProgramType uint8
ProgramType represents the type of a program.
const ( // TestProgramType represents the type of a test program. // Test programs are to be used for debugging and testing purposes only. TestProgramType ProgramType = iota // WebProgramType represents the type of a web program. WebProgramType )
type Table ¶
Table represents a Luau table, with resizeable list and hash parts. Luau type `table` As tables are compared by reference, this type must always be used as a pointer.
func (*Table) GetHash ¶
GetHash returns a value at a key, only searching the hash part of the table.
func (*Table) Iter ¶
Iter returns an iterator over the table, yielding key-value pairs in a deterministic order.
func (*Table) Len ¶
Len returns the length of the list part of the table (the length of the list up until the first nil).
type Vector ¶
type Vector [4]float32
Vector represents a 3-wide or 4-wide vector value. Luau type `vector`
type WebArgs ¶
type WebArgs struct {
Url WebArgsUrl `json:"url"`
Method string `json:"method"`
Headers map[string]string `json:"headers"`
Body []byte `json:"body"`
}
WebArgs stores the arguments passed to a web program.
type WebArgsUrl ¶
type WebArgsUrl struct {
Rawpath string `json:"rawpath"`
Path string `json:"path"`
Rawquery string `json:"rawquery"`
Query map[string][]string `json:"query"`
}
WebArgsUrl represents a parsed URL and its properties.