Welcome Guest Search | Active Topics | Log In | Register

hello everyone
#1 Posted : Monday, June 4, 2018 5:05:46 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/3/2018(UTC)
Posts: 1

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Is it possible to pass objects (instances of classes) between squirrel and C++? As far as I was able to tell, you can only pass primitives (which, I suppose, you could use to reconstruct classes -- but that seems wasteful). If there is (or if that is the only way) -- can you give me an example of it? Thanks! .
#2 Posted : Wednesday, June 27, 2018 11:35:27 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/23/2014(UTC)
Posts: 122
Location: Northern Germany & Lincolnshire, U.K.

Thanks: 1 times
Was thanked: 10 time(s) in 10 post(s)
The manual approach would be to define a Squirrel class using the API once, then for each instance set the Squirrel instances' user pointer to the c++ class instance or a structure somehow referencing the c++ instance. Basically. Sounds easy, but absolutely isn't, as there is an awful lot of things to take care of. Almost impossible to put an example here.
From the way you put your request I relly don't recommend to take the long route, though. Try using a library like SQPlus (outdated), SQRat or the like as a start.

Though, it depends on what you want to achieve? Just to pass pointers to Squirrel which it could pass back somewhere (without any other interaction on Squirrels side) is much easier - see userdata object type.
Users browsing this topic
Guest (2)
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.049 seconds.