lua

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	META  = "meta"
	FUNC  = "function"
	CLASS = "class"
	TABLE = "table"
)

Variables

This section is empty.

Functions

func GenerateTypeDefinitions

func GenerateTypeDefinitions(glue *core.Glue) string

func NewLuaScaffold

func NewLuaScaffold(glue *core.Glue) Scaffold

Types

type Annotable

type Annotable interface {
	Render() string
	Type() string
}

type LuaAnnotations

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

func (*LuaAnnotations) Add

func (annotations *LuaAnnotations) Add(annotation Annotable)

func (*LuaAnnotations) AddClass

func (annotations *LuaAnnotations) AddClass(name string, fields []runtime.Field)

func (*LuaAnnotations) AddFunction

func (annotations *LuaAnnotations) AddFunction(mod *core.GluePlugin)

func (*LuaAnnotations) FindAllByType

func (annotations *LuaAnnotations) FindAllByType(kind string) []Annotable

func (*LuaAnnotations) Render

func (annotations *LuaAnnotations) Render() string

func (*LuaAnnotations) Type

func (annotations *LuaAnnotations) Type() string

type LuaClassAnnotation

type LuaClassAnnotation struct {
	Name   string
	Fields []runtime.Field
}

func (*LuaClassAnnotation) Render

func (classAnnotation *LuaClassAnnotation) Render() string

func (*LuaClassAnnotation) Type

func (classAnnotation *LuaClassAnnotation) Type() string

type LuaFuncAnnotation

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

func (*LuaFuncAnnotation) Render

func (funcAnnotation *LuaFuncAnnotation) Render() string

func (*LuaFuncAnnotation) Type

func (mod *LuaFuncAnnotation) Type() string

type LuaRC

type LuaRC map[string]interface{}

func InitLuaRC

func InitLuaRC(folder string) (LuaRC, error)

InitLuaRC initializes a LuaRC configuration from a specified folder. It looks for a file named ".luarc.json" within the folder. If the file does not exist, it initializes an empty one

func LoadLuaRC

func LoadLuaRC(file string) (LuaRC, error)

LoadLuaRC tries to loads a LuaRC configuration from a specified file. It reads the file content and unmarshals the JSON data into a LuaRC map.

func (LuaRC) AddLibrary

func (luarc LuaRC) AddLibrary(name string)

AddLibrary adds a library name to the LuaRC configuration. It ensures that the library name is added to the "workspace.library" key. If the "workspace.library" key does not exist, it creates it. If the library name already exists in the list, it does not add it again.

func (LuaRC) SaveToFolder

func (luarc LuaRC) SaveToFolder(folder string) error

SaveToFolder saves the LuaRC configuration to a specified folder. It writes the configuration to a file named ".luarc.json" within the folder. The file permissions are set to 0644 by default, but if the file already exists, it retains the existing file permissions

func (LuaRC) ToJSON

func (luarc LuaRC) ToJSON() (string, error)

ToJSON converts the LuaRC configuration to its JSON string representation. It marshals the LuaRC map into a JSON formatted string. If the marshalling process encounters an error, it returns an empty string and the error. Otherwise, it returns the JSON string and a nil error.

type LuaScaffold

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

func (*LuaScaffold) Setup

func (s *LuaScaffold) Setup(folder string) error

func (*LuaScaffold) Typegen

func (s *LuaScaffold) Typegen() string

type LuaTableAnnotation

type LuaTableAnnotation struct {
	Name     string
	Children []*LuaTableAnnotation
}

func (*LuaTableAnnotation) AddChild

func (tableAnno *LuaTableAnnotation) AddChild(name string) *LuaTableAnnotation

func (*LuaTableAnnotation) Render

func (tableAnno *LuaTableAnnotation) Render() string

func (*LuaTableAnnotation) Type

func (tableAnno *LuaTableAnnotation) Type() string

Jump to

Keyboard shortcuts

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