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

question: extending slices and getting data out #342

Closed
SandyWalsh opened this issue Aug 13, 2020 · 1 comment
Closed

question: extending slices and getting data out #342

SandyWalsh opened this issue Aug 13, 2020 · 1 comment

Comments

@SandyWalsh
Copy link

SandyWalsh commented Aug 13, 2020

Sorry for the n00b questions ... been having fun playing with this library.

I'm doing this

        type Foo {
               Things []string
        }

        ptrs := []*Foo{}
	err = ev.Define("foo", ptrs)
	if err != nil {
		return nil, err
	}

	_, err = vm.Execute(ev, nil, script)
	if err != nil {
		return nil, err
	}

	outi, err := ev.Get("foo")
	if err != nil {
		return nil, err
	}

and in my script I'm (effectively) doing

    foo[0].Things = foo[0].Things + "new thing"

But I'm not seeing "new thing" coming out. Should I be using some sort of append()-like call?

Also, the Execute() call has a return value ... what's in it? And how do I set it? Don't see anything in the docs about it.

@SandyWalsh
Copy link
Author

nm ... figured it out.

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

1 participant