Skip to content

Latest commit

 

History

History
30 lines (27 loc) · 770 Bytes

ADD_YOUR_OWN_METHODS.md

File metadata and controls

30 lines (27 loc) · 770 Bytes

How to make your own methods for RedoLanguage in Go

Now you can only use Go since RedoLanguage doesn't support function declaration

In std/functions.go you can find the Functions map, there are 2 ways to add to the map And commands must follow this to be stable func(args ...interface{}) interface{}

func LoadCommands() {
    Functions["input"] = Input
}
func Input(args ...interface{}) interface{}
  fmt.Println(args...)  
}

or

var Functions = map[string]func(args ...interface{}) interface{}{
    //OTHER METHODS
    "input": Input
    
}
var Functions = map[string]func(args ...interface{}) interface{}{
    //OTHER METHODS
    "input": func(args ...interface{}) interface{} {
         fmt.Println(args...)  
    },
    
}