Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

e154/console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#go console

golang console for embedded code

init

init as singleton

c_ptr := console.GetPtr()

use

set output handler

type someHandler struct {}

func (p *someHandler) Output(text []byte) {
    fmt.Println(string(text))
}

c_ptr.Output(h)

variables

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")

functions

function assignment:

t := &testFunc{}
c_ptr.AddCommand("test", t.ShareMethod)

exec function with args

c_ptr.Exec("test")
c_ptr.Exec("test true")

local help

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