Destructors in Squirrel?

Started by ysc3839, Jun 22, 2016, 09:38 AM

Previous topic - Next topic

ysc3839

Does Squirrel have class destructors?

Xmair


Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

ysc3839

Also can I make destructors using squirrel plugin?

Finch Real

My Snipet Showroom

http://pastebin.com/5KKuU5cg

.

Quote from: ysc3839 on Jun 22, 2016, 09:38 AMDoes Squirrel have class destructors?

No, Squirrel does not have any concept of destructors.

Quote from: ysc3839 on Jun 22, 2016, 10:08 AMAlso can I make destructors using squirrel plugin?

Yes, but not for script types. For your registered types.
.

ysc3839

Quote from: . on Jun 22, 2016, 10:57 AM
Quote from: ysc3839 on Jun 22, 2016, 09:38 AMDoes Squirrel have class destructors?

No, Squirrel does not have any concept of destructors.

Quote from: ysc3839 on Jun 22, 2016, 10:08 AMAlso can I make destructors using squirrel plugin?

Yes, but not for script types. For your registered types.
Thanks. I want to know if I registered a class using plugin, can it support destructors?
Also, is there any sample code?

.

Register it how? With Sqrat the binding utility or manually through the provided API?
.

ysc3839

Quote from: . on Jun 22, 2016, 02:46 PMRegister it how? With Sqrat the binding utility or manually through the provided API?
Thanks. I'll see sqrat.
Solved.

.

Quote from: ysc3839 on Jun 22, 2016, 03:05 PMThanks. I'll see sqrat.
Solved.

Using Sqrat in modules for the official plugin could prove to be a bit difficult without compiling Squirrel into your module again (must be same version). You might be able to trick Sqrat and use it without having to link your program to Squirrel.
.

ysc3839

Quote from: . on Jun 22, 2016, 03:22 PM
Quote from: ysc3839 on Jun 22, 2016, 03:05 PMThanks. I'll see sqrat.
Solved.

Using Sqrat in modules for the official plugin could prove to be a bit difficult without compiling Squirrel into your module again (must be same version). You might be able to trick Sqrat and use it without having to link your program to Squirrel.
Thanks. I'm seeing 0.4 Socket.

.

#10
Quote from: ysc3839 on Jun 22, 2016, 03:37 PMThanks. I'm seeing 0.4 Socket.

Well, that's because it compiles Squirrel again into the module. You should find the actual Squirrel source in there with the module. Which is not ideal. because you will end up having a VM that will receive memory allocations from both the main plugin and your module. Either way, you're in for some subtle crashes if you follow the same approach.

You could look at how I made Sqrat think that Squirrel is compiled into my modules here. Although, it involved making some modifications to Sqrat (regarding what headers it should include). Actually, I did a lot of other modifications to Sqrat as well. But that's ok since Sqrat is no longer updated. This is what should interest you. And this.
.

ysc3839

Quote from: . on Jun 22, 2016, 03:50 PM
Quote from: ysc3839 on Jun 22, 2016, 03:37 PMThanks. I'm seeing 0.4 Socket.

Well, that's because it compiles Squirrel again into the module. You should find the actual Squirrel source in there with the module. Which is not ideal. because you will end up having a VM that will receive memory allocations from both the main plugin and your module. Either way, you're in for some subtle crashes if you follow the same approach.

You could look at how I made Sqrat think that Squirrel is compiled into my modules here. Although, it involved making some modifications to Sqrat (regarding what headers it should include). Actually, I did a lot of other modifications to Sqrat as well. But that's ok since Sqrat is no longer updated. This is what should interest you. And this.
I don't know what you mean. 0.4 Socket source code don't include Squirrel. It uses main plugin's Squirrel VM.