|
| 27 Sep 2014 06:31 PM |
I have one function already made that paints parts depending on their name, regardless of what model they're in. (I can give you the script if you want a copy of it. It's rather impressive in my opinion)
The function targets parts if they are specifically named "Primary Color" but I was hoping someone had a way to target said parts if they simply had the word Primary somewhere in their name. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 27 Sep 2014 06:33 PM |
local str = 'THIS IS NOT A PRIMARY COLOR'
function toboolean(v) return v and true or false end
print(toboolean(str:lower():match'primary')) |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 06:42 PM |
Ok that's a better example than the wiki gave me about the match method.
It's as simple as:
if Part.Name:match("Primary") then |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 27 Sep 2014 06:44 PM |
That will match with the EXACT format of "Primary"
the way I did it made it so PRIMARY works
or primary
or pRimAry.
Also, the match function includes Lua's version of Regular Expressions (String Pattern) that allows you to do fancy matching for specific matches of characters which is why it is so complex. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 06:47 PM |
The exact pattern works fine for me. I kinda have OCD anyways... xD Or I'm a grammar knot-zee
Probably both. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 07:06 PM |
By the way I forgot to say thank you.
So... Thank you. :) |
|
|
| Report Abuse |
|
|