callback

package
v0.0.0-...-05c4345 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback interface {
	// Do schedules the callback
	Do(args ...lua.LValue) <-chan error

	// From schedules the callback to be executed on the loop
	// The passed function is executed just before the callback and can
	// be used to construct lua objects
	From(func(*lua.LState) []lua.LValue) <-chan error

	// Callable returns the callbacks callable. Use with care
	Callable() *lua.LFunction

	// BindChannelErrors binds the callback to the given channel and executes/schedules
	// a callback invocation per message. For each execution, either nil or an error is
	// returned
	BindChannelErrors(ch <-chan []lua.LValue) <-chan error

	// BindChannel works like BindChannelErrors but ignores any errors returned by
	// a callback invocation
	BindChannel(ch <-chan []lua.LValue)
}

Callback represents a lua callback that can be scheduled on the event loop

func LGet

func LGet(stack int, L *lua.LState) Callback

LGet returns a Callback for the function passed at parameter index `stack`

func LGetOpt

func LGetOpt(stack int, L *lua.LState) Callback

LGetOpt works like LGet but returns nil if no function has been passed

func New

func New(callable *lua.LFunction, loop eventloop.Loop) Callback

New returns a new callback

Jump to

Keyboard shortcuts

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