Im embedding Squirrel into a project and am having an issue. Ive had good luck with it to this point engaging native methods and the like, but I wish to allow binding properties from C++ on the squirrel end. Im able to overload _set okay but _get is causing major headaches.
My squirrel class in question is here:
Code:class Console extends Object
{
OnLogUpdated = null;
constructor()
{
Object.constructor();
OnLogUpdated = ConsoleEventDelegate();
echo("Console initialized");
}
}
If I add a _get native closure to this class, it will invoke asking me for the location of "Object" ??? and then fail because it can't find the constructor identifier. I'm registering _get with the class before I instance it so I dont think that would be a problem but that appears to be false. Any help would be greatly appreciated.
for the record the code i wrote to bind the closures looks like so:
Code:
int fulltop = sq_gettop( mVM );
sq_pushroottable( mVM );
sq_pushstring( mVM, _SC(klass->getClassname()), -1 ); //would be "Console"
sq_get( mVM, -2 );
//register property get/set
sq_pushstring( mVM, _SC("_set"), -1 );
sq_newclosure( mVM, scriptOnObjectSet, 0 );
sq_newslot( mVM, -3, SQFalse );
sq_pushstring( mVM, _SC("_get"), -1 );
sq_newclosure( mVM, scriptOnObjectGet, 0 );
sq_newslot( mVM, -3, SQFalse );
sq_settop( mVM, fulltop );