basic

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MechBasic

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

func NewMechanicalBasic

func NewMechanicalBasic() *MechBasic

func (*MechBasic) Call

func (mb *MechBasic) Call(funcName string, args ...any) (any, error)

Call invokes a script-defined function by name with the provided arguments Each call starts with a fresh scope - variables do not persist between calls

func (*MechBasic) HasFunction

func (mb *MechBasic) HasFunction(funcName string) bool

HasFunction checks if a function with the given name exists in the loaded script

func (*MechBasic) Load

func (mb *MechBasic) Load(code string) error

Load parses the script and registers function definitions without executing top-level code

func (*MechBasic) RegisterFunc

func (mb *MechBasic) RegisterFunc(name string, function func(args ...any) (any, error))

func (*MechBasic) RegisterMathLibrary

func (mb *MechBasic) RegisterMathLibrary()

func (*MechBasic) Run

func (mb *MechBasic) Run(code string) error

func (*MechBasic) SetPrintFunc

func (mb *MechBasic) SetPrintFunc(fn func(value any))

Jump to

Keyboard shortcuts

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