lua

package
v0.0.0-...-126e10b Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 9 Imported by: 0

README

Global Lua Environment Service

The purpose of this Service Mesh service is to manage the state of a single lua state machine. Other services are intended to implement an exported integration interface in order to populate the state machine with anything they want. Any type of lua API for a given service should be exposed through this service. It is recommended that other services document their API in either a README.md or in a LUA.md

Dependencies

This service depends upon the config file service and will initialize its own default config.

Integration with other services

This service exports an integration interface ManagesLuaEnvironment with an alias Dependencncy which are intended to be used by other services for dependency resolution (see servicemesh.HasDependencies), and expose just the methods which other services should use.

Another service may merely store a reference to this service and use the lua state machine explicitly with the folloing interface:

type Dependency = ManagesLuaEnvironment

type ManagesLuaEnvironment interface {
    LuaState() *lua.LState
}

Other services should use the ManagesLuaEnvironment or Dependency interfaces to resolve their dependency on this service.


However, implementors of the following interface methods are invoked by the lua service indirectly whenever the service is added or removed from the servicemesh.

type UsesLuaEnvironment interface {
    ExportToLua(state *lua.LState)
    UnexportFromLua(state *lua.LState)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency = ManagesLuaEnvironment

type ManagesLuaEnvironment

type ManagesLuaEnvironment interface {
	LuaState() *lua.LState
}

type Service

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

func (*Service) ConfigFileName

func (s *Service) ConfigFileName() string

func (*Service) DefaultConfig

func (s *Service) DefaultConfig() (cfg configFile.Config)

func (*Service) FileHandlers

func (s *Service) FileHandlers() map[string]fileWatcher.FileHandlerFunc

func (*Service) Init

func (s *Service) Init(mesh servicemesh.Mesh)

func (*Service) LoadConfig

func (s *Service) LoadConfig(config *configFile.Config)

func (*Service) Logger

func (s *Service) Logger() *slog.Logger

func (*Service) LuaState

func (s *Service) LuaState() *lua.LState

func (*Service) Name

func (s *Service) Name() string

func (*Service) OnServiceAdded

func (s *Service) OnServiceAdded(service servicemesh.Service)

func (*Service) Ready

func (s *Service) Ready() bool

func (*Service) SetLogger

func (s *Service) SetLogger(logger *slog.Logger)

type UsesLuaEnvironment

type UsesLuaEnvironment interface {
	ExportToLua(state *lua.LState)
	UnexportFromLua(state *lua.LState)
}

Jump to

Keyboard shortcuts

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