Just when I thought I had this sorted! Using the example we discussed a month or so ago the only difference being that I am allocating an instance of foo dynamically so
// Explicit instances
int myMethod(int i, int j);
// we have a chaiscript and we have a Foo, so let's use a Lambda and pass that to chaiscript
foo* f = new foo;
chai.add(chaiscript::fun(static_cast<void (foo::*)(int, int)>(&foo::myMethod)), "myMethod"); // add method
chai.add(chaiscript::var(f), "f"); // add object
When I invoke
I simply get the error
"Script error in script: Error: "Can not find object: f" during evaluation at (EVAL 63, 9)
The only thing I did (slightly) differently is that I didn't take the address since I was already passing an object pointer.
By the way, I do not get any errors adding the "f" in the first place.
What am I missing?