lua

package
v0.0.0-...-20fe154 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrApplicationNotEspecified = errors.New("Application ID not especified")
)

common errors

Functions

This section is empty.

Types

type Lang

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

Lang is the struct that holds all language commands

func New

func New(backd *backd.Backd) *Lang

New returns an instance of a Lua interpreter with the backd

client inside. This allow us to integrate it in many places.

Language initialization requires a backd client with endpoints

configurated

func (*Lang) Clone

func (l *Lang) Clone() *Lang

Clone returns a new instance of Lang copying current configuration of

backd and Lua configuration

func (*Lang) Interactive

func (l *Lang) Interactive() int

Interactive starts the lua powered backd cli

func (*Lang) LoadLuaPackage

func (l *Lang) LoadLuaPackage(name string, fn lua.LGFunction) error

LoadLuaPackage imports a package to the virtual machine

func (*Lang) PrepareFunctions

func (l *Lang) PrepareFunctions() *Lang

PrepareFunctions executes a script file passed as argument

func (*Lang) RunFunction

func (l *Lang) RunFunction(code string, input map[string]interface{}) (output map[string]interface{}, err error)

RunFunction executes the code passed as string.

every function looks for a map as input, returns a map and error (if any)

func (*Lang) RunScript

func (l *Lang) RunScript(filename string) int

RunScript executes a script file passed as argument

func (*Lang) SetAppID

func (l *Lang) SetAppID(appID string)

SetAppID allows to set an application ID from Go

func (*Lang) SetSession

func (l *Lang) SetSession(sessionID string, expiresAt int64)

SetSession sets the correct session to be used from the backd client

Jump to

Keyboard shortcuts

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