Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

OnGetNetPage vs OnLeave in New Project wizard

<< < (2/4) > >>

jimbo:

--- Quote from: BlueHazzard on November 20, 2018, 12:27:31 pm ---sadly we are using squirrel 2.2.5 and there the find methode does not exists...


@obfuscate: what about updating squirrel, without going to sqrat? Squirrel is now at 3.1 with tons of fixes and additions. 2.2 is 8 years old...

--- End quote ---

I've also found that the string.slice funcion appears to be missing (same error) but that should be in Squirrel 2.2 which is odd.


--- Code: ---local s = _T("abcdefghijklmnop");
local s2 = s.slice(0,5);   <<<<<<<<< AN ERROR HAS OCCURED [the index 'slice' does not exist]
--- End code ---

oBFusCATed:
@jimbo: s is not a string type, it is wxString. Search the wiki for the function reference provided by C::B in squirrel scripts.

@bluehazzard: I'm fine if you can make 3.x work with SqPlus, but I think the two were incompatible. I could be wrong of course.

jimbo:

--- Quote from: oBFusCATed on November 20, 2018, 07:12:15 pm ---@jimbo: s is not a string type, it is wxString. Search the wiki for the function reference provided by C::B in squirrel scripts.

--- End quote ---

AhHa! Knew I was doing something stupid. Thanks.

BlueHazzard:
Just a little update (and also a permanent note for me, because i do not want again debug a few hours for this)
Porting the scripting engine to 3.0 is not easy possible with sqplus, because squirrel 3.0 releases variables after poping from the internal stack.
This is basically not the problem, but sqplus always returns a reference as return value of squirrel functions. After the scripting function call sqplus stores the reference to the return value and cleans the stack. This will destroy the variable returned by the squirrel function, if this variable was only existent in this function. So the from sqplus stored reference to the return value is now invalid and sqplus returns an invalid reference to the c++ user code. This is very unfortunate. I tried to implement a function that returns a copy of the object , but then all non copyable script bindings (like the ProjectManager) can not be used anymore.
Maybe i split them out...
It is not trivial, and you have to be very carefully with the type of return value you use.
I do not remember how sqrat solves this problem...

BlueHazzard:
Ok, here is a repo with the updated squirrel code and fixed sqplus code.

https://github.com/bluehazzard/codeblocks_sf/tree/test/squirrel/update/31/1

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version