NFFunction

package
v0.0.0-...-6b2d15a Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExportPath = "exports/functions"

ExportPath is the path where the function will be exported

Functions

func ExportRegistered

func ExportRegistered()

ExportRegistered exports all registered functions to json files

func Load

func Load(path string) (a NFObjects.AssetProperties, err error)

Load is a function that is used to load a function from a .NFFunction file

func ParseAndRun

func ParseAndRun(window fyne.Window, function string, args *NFData.NFInterfaceMap) (*NFData.NFInterfaceMap, error)

ParseAndRun parses a function from its string name runs it and returns the results

Types

type Function

type Function struct {
	// Name is the name of the function for later reference in editing
	Name string `json:"Name"`
	// UUID is the Universally Unique Identifier of the function
	UUID uuid.UUID `json:"UUID"`
	// Action is the action that the function will be called on(OnTapped, OnHover, etc)
	Action string `json:"Action"`
	//Priority is the order in which the function will be called in relation to other action based functions
	Priority int `json:"Priority"`
	//Type is the type of function that is used to parse the function this should be Globally Unique, so when making
	//custom ones prefix it with your package name like "MyPackage.MyFunction"
	Type string `json:"Type"`
	//RequiredArgs is a list of arguments that are required for the function to run
	RequiredArgs *NFData.NFInterfaceMap `json:"-"` //This is not exported to json
	//OptionalArgs is a list of arguments that are optional for the function to run
	OptionalArgs *NFData.NFInterfaceMap `json:"-"` //This is not exported to json
	//Args is a list of arguments that are passed to the function through the scene
	Args *NFData.NFInterfaceMap `json:"Args"`
}

func GetFunctionInfo

func GetFunctionInfo(function string) (Function, error)

func New

func New(action, functionType string, args *NFData.NFInterfaceMap) *Function

func (*Function) CheckArgs

func (f *Function) CheckArgs() error

CheckArgs checks if the function has all the required arguments

func (*Function) Export

func (f *Function) Export() error

Export is a function that is used to export the function to a json file These files are used in the main editor to determine inputs needed to call a function in a scene

func (*Function) FetchIDs

func (f *Function) FetchIDs() []uuid.UUID

func (*Function) GetArgs

func (f *Function) GetArgs() *NFData.NFInterfaceMap

func (*Function) GetID

func (f *Function) GetID() uuid.UUID

func (*Function) GetName

func (f *Function) GetName() string

func (*Function) GetType

func (f *Function) GetType() string

func (*Function) MakeId

func (f *Function) MakeId()

func (*Function) Register

func (f *Function) Register(handler functionHandler)

Register adds a custom function to the Functions map

func (*Function) Run

func (f *Function) Run(window fyne.Window, newValues *NFData.NFInterfaceMap) (*NFData.NFInterfaceMap, error)

func (*Function) SetAndCheckArgs

func (f *Function) SetAndCheckArgs(args *NFData.NFInterfaceMap) error

SetAndCheckArgs sets the arguments and checks if the function has all the required arguments

func (*Function) SetArgs

func (f *Function) SetArgs(args *NFData.NFInterfaceMap)

func (*Function) SetName

func (f *Function) SetName(newName string)

func (*Function) SetType

func (f *Function) SetType(t string)

func (*Function) Validate

func (f *Function) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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