Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded use: Provide an object #874

Open
aubelsb2 opened this issue Mar 10, 2021 · 1 comment
Open

Embedded use: Provide an object #874

aubelsb2 opened this issue Mar 10, 2021 · 1 comment

Comments

@aubelsb2
Copy link

Before you submit the issue, please provide us following information:

  • Your operating system
    Windows 10
  • How did you install Goby
    go get
  • Goby version
    go.mod:
	github.com/goby-lang/goby v0.1.13
  • The value of $GOBY_ROOT
    Reference go path location
  • Error messages
    n/a

Usage:
I'm trying to introduce a variable. I am using "getExecresult()" but it's untested due to an issue providing GOBY_ROOT during test. -- I understand this is designed to be used as a stand alone executable. However I am trying to provide a Ruby-like environment for custom code / extensions to users.

	v, err := vm.New("./", []string{})
	if err != nil {
		return false, err
	}
	instructionSets, err := compiler.CompileToInstructions(code, parser.NormalMode)
	if err != nil {
		return false, err
	}
	dataObject := v.InitObjectFromGoType(data)
	v.GetExecResult().InstanceVariableSet("data", dataObject)
	v.ExecInstructions(instructionSets, "code.rb")
	return v.GetExecResult().Value() == true, nil
@st0012
Copy link
Member

st0012 commented Mar 14, 2021

I'm kinda puzzled by the description. can you elaborate more about what's your goal and what's blocking you? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants