User forums > Using Code::Blocks
Squirrel Documentation: ".Matches"
(1/1)
BackInTheSandbox:
Hi,
a long time ago I got some help in this forum:
--- Quote from: BlueHazzard on March 05, 2020, 03:53:29 pm ---You probably can use squirrel scripting to do what you want...
--- Code: ---[[if(ReplaceMacros(_T("$TARGET_NAME")).Matches(_T("Debug"))){print("MYDEBUG");} else {print("MYRELEASE");}]]
--- End code ---
--- End quote ---
That script worked very well but now I need to change that script. I don't want to check, if the build target is "Debug". I want to check, if the target contains "Debug". Basically I want this:
--- Code: ---[[if(ReplaceMacros(_T("$TARGET_NAME")).Contains(_T("Debug"))){print("MYDEBUG");} else {print("MYRELEASE");}]]
--- End code ---
This doesn't work, because 'Contains' is not a valid keyword."No problem" I thought, just google the squirrel documentation. But I'm surprised to find that there isn't even 'Matches' mentioned anywhere in the documentation. So I'm at a loss here. Can anyone point me to a documentation about squirrel scripting for Code::Blocks?
https://wiki.codeblocks.org/ gives me a "Service Unavailable".
Thanks in advance,
BackInTheSandbox
Miguel Gimenez:
There are bindings in C::B source for many wxString methods, see src\sdk\scripting\bindings\sc_wxtypes.cpp
--- Code: ---BindMethod(v, _SC("Matches"), wxString_Matches, _SC("wxString::Matches"));
--- End code ---
You can add one binding for Contains() (it should be straightforward) or continue using Matches() with wildcards.
EDIT: You can also use Find().
BackInTheSandbox:
--- Quote from: Miguel Gimenez on August 31, 2023, 01:50:36 pm ---There are bindings in C::B source for many wxString methods, see src\sdk\scripting\bindings\sc_wxtypes.cpp
--- Code: ---[...] or continue using Matches() with wildcards.
--- End code ---
--- End quote ---
Thank you very much! Wildcards are sufficient for my task.
Regards,
BackInTheSandbox
Navigation
[0] Message Index
Go to full version