#go console
golang console for embedded code
init as singleton
c_ptr := console.GetPtr()
set output handler
type someHandler struct {}
func (p *someHandler) Output(text []byte) {
fmt.Println(string(text))
}
c_ptr.Output(h)
assignment of variables to be able to access them
c_ptr.AddBool("bb", &bb)
c_ptr.AddFloat("ff", &ff)
c_ptr.AddInt("ii", &ii)
c_ptr.AddString("ss", &ss)
update varibles from code
c_ptr.Exec("set ii 22")
function assignment:
t := &testFunc{}
c_ptr.AddCommand("test", t.ShareMethod)
exec function with args
c_ptr.Exec("test")
c_ptr.Exec("test true")
default commands:
c_ptr.Exec("ls")
ls
variables:
bb,ff,ii,ss,
console commands:
ls - prints all variables and commands
get - get value of variables
set - sets value of variable
help - this help
created for http://e154.ru