luaengine

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetWinsize

func SetWinsize(fd uintptr, w, h int)

Types

type KeyValue added in v0.1.12

type KeyValue struct {
	Key   string
	Value string
}

type LuaExtender

type LuaExtender struct {
	Proto        *lua.FunctionProto
	ExternalExec bool
	Users        *map[string]*database.User
	User         *database.User
	Term         *term.Term
	ServerConn   *ssh.ServerConn
	Conn         ssh.Channel
	IsConnected  bool
	Environment  map[string]string
	// contains filtered or unexported fields
}

LuaExtender holds an instance of the moon interpreter and the state variables of the extensions we made.

func New

func New(cfg config.Config,
	users *map[string]*database.User,
	user *database.User,
	term *term.Term,
	serverConn *ssh.ServerConn,
	conn ssh.Channel,
) *LuaExtender

New creates a new instance of LuaExtender.

func (*LuaExtender) ClearTriggers added in v0.1.12

func (le *LuaExtender) ClearTriggers(l *lua.LState) int

func (*LuaExtender) Close

func (le *LuaExtender) Close() error

func (*LuaExtender) Compile

func (le *LuaExtender) Compile(filePath string) (*lua.FunctionProto, error)

CompileLua reads the passed lua file from disk and compiles it.

func (*LuaExtender) DoCompiledFile

func (le *LuaExtender) DoCompiledFile(L *lua.LState, proto *lua.FunctionProto) error

DoCompiledFile takes a FunctionProto, as returned by CompileLua, and runs it in the LState. It is equivalent to calling DoFile on the LState with the original source file.

func (*LuaExtender) GetState

func (le *LuaExtender) GetState() *lua.LState

GetState returns the state of the moon interpreter.

func (*LuaExtender) InitState

func (le *LuaExtender) InitState() error

InitState starts the lua interpreter with a script.

func (*LuaExtender) Input

func (le *LuaExtender) Input(s string)

func (*LuaExtender) RunTrigger

func (le *LuaExtender) RunTrigger(name string) (bool, error)

RunTrigger executes a pre-configured trigger.

type Winsize

type Winsize struct {
	Height uint16
	Width  uint16
	// contains filtered or unexported fields
}

Winsize stores the Height and Width of a terminal.

Jump to

Keyboard shortcuts

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