YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

SQRat :: default values for constructors
JonHodgson
#1 Posted : Friday, June 10, 2016 10:09:03 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2016(UTC)
Posts: 15
Location: UK

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi,

I have various bits of functionality that I need to attach to Squirrel as C++ classes.

Doing this with SQRat is simple enough... however...

To operate they require certain context information, which is known at the time of binding.

So the constructor might look something like

Code:


class ParameterListener {

ParameterListener { ParameterTree* parameter_tree,
                    Sqrat::Object sq_callback_object,
                sq_string sq_callback_function,
                sq_string search_string );

};



Where the value of parameter_tree is known at bind time.

Now, I assume I could set the value in a slot in Squirrel, and then construct a ParameterListener Object in squirrel with

Code:

parameter_listener = ParameterListener(the_parameter_tree, this, OnParameterChange, "");


But the thing is, since in this case there will only ever be one parameter tree for a single Squirrel VM, and it won't change in location during the lifetime of the VM, I would rather that the script writer didn't have to think about it, and could just write

Code:

parameter_listener = ParameterListener(this, OnParameterChange, "");


So, is there a way to bind cnostructors (and other functions ideally) such that onky some parameters are exposed to Squirrel, and the others are filled with values given at bind time?

regards

Jon
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.071 seconds.