A problem constructing objects in a script code
I wrapped a function to be called as class-constructor from a scipt code:
- {
- context->thisObject().setProperty("x", context->argument(0));
- context->thisObject().setProperty("y", context->argument(1));
- context->thisObject().setProperty("z", context->argument(2));
- return engine->undefinedValue();
- }
and registed it in my engine:
- engine.globalObject().setProperty("Pos", engine.newFunction(Pos, proto));
When I tried to execute a simple script
- var p1 = new Pos(1, 2, 3);
- var p2 = new Pos(10, 20, 30);
I found p1-object properties being initialized with the second object constructor arguments – (10, 20, 30). It seem’s context->thisObject() doesn’t switch to p2. Can anybody help me with this?
0 replies
You must log in to post a reply. Not a member yet? Register here!
