|
| 29 Jul 2012 03:00 AM |
When using gmatch to find a pattern in a string, I know "%D" gets any character that's non-digit. How would you get any character that's not a magic character like ^ or @? |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 03:03 AM |
| I think... Hmm.. That's a hard one, maybe %a and %d. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 03:10 AM |
I'm creating an anti-insert script to prevent people from inserting objects via ToolBox; I've seen some free models that do this, but I don't like the way they do it, since they create an if statement for every single possible object possible. So I compiled all the possible objects's Names in a string value (using a script of course) and the Names are separated by a ^.
houseInteriorKitchenOven^houseInteriorCountersBtm^houseInteriorSink is a part of the string value
Some of the names contain underscores and stuff, so just searching for alphanumeric characters wouldn't work. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 03:11 AM |
| Don't use free models then... |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 03:19 AM |
I'm not, that's why I'm trying to figure out how to capture all characters in a string that are non-magic characters.
Here's a section of my script
local NotAllowed = {}
for name in script.RestrictedItems.Value:gmatch("%P+") do table.insert(NotAllowed,name) end
--
And here's a part of RestrictedItems.Value
^houseInteriorBathroomMirror^castleSteeple^castleSteeple^Superball
It doesn't work with items with underscores in their name like Spikes_Simple So the question is how to capture everything but that ^ character. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 03:20 AM |
| Oh I get it, but I think you can use two at a time, I'm not entirely sure, though. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 01:40 PM |
| I'ma bump this since I started this thread when everyone else was sleeping. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 01:56 PM |
| Are underscores white space or punctuation? |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 02:03 PM |
I'm pretty sure they're not considered either of those.
You don't end your sentences like this, do you_ And_using_them_as_spaces_is_just_silly. |
|
|
| Report Abuse |
|
|
| |
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 29 Jul 2012 02:26 PM |
"Any non-magic character (not one of ^$()%.[]*+-?), represents itself in a pattern." -The wiki
Well, based on that, you can't do what you are attempting to do. Sorry. :( Time to update this siggy, to this: ! |
|
|
| Report Abuse |
|
|