Object will run the given source and return the result as an object.

For example, accessing an existing object:

object, _ := vm.Object(`Number`)

Or, creating a new object:

object, _ := vm.Object(`({ xyzzy: "Nothing happens." })`)

Or, creating and assigning an object:

object, _ := vm.Object(`xyzzy = {}`)
object.Set("volume", 11)

If there is an error (like the source does not result in an object), then nil and an error is returned.

Object is referenced in 16 repositories