This repository was archived by the owner on Jul 12, 2025. It is now read-only.
This repository was archived by the owner on Jul 12, 2025. It is now read-only.
Embedded use: Provide an object #874
Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels