Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Capturing characters only after a specific character has appeared.
Capturing characters only after a specific character has appeared.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Wuggly
USA (112 posts) Bio
|
Date
| Fri 08 Jul 2016 08:01 PM (UTC) Amended on Fri 08 Jul 2016 09:14 PM (UTC) by Wuggly
|
Message
| Hello again,
I am currently trying to figure out how to gsub out a bunch of words if a specific character is in that line.
I've found some solutions in other languages, but not Lua and I can't quite figure out how to convert it over.
Here's one of the C# solutions.
string line = line.Substring(A.IndexOf('>') + 1);
And here's my failed attempt.. (although I never actually tested it)
line = string.gsub (line, ">", IndexOf(">") + 1)
Probably needs to be regex, but figured it wouldn't work anyways.
-Extra question since I'm apparently limited to 1 thread, although this probably doesn't need its own thread, and also cannot make anymore replies (Cannot create more threads today): Anyways, when is a plugin too big? Is that possible? I'm just wondering because my plugin has now reached over 6000 lines of code. Will I be able to keep going with it, or will I have to eventually split it up into multiple plugins? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 09 Jul 2016 06:22 AM (UTC) |
Message
|
Quote:
Anyways, when is a plugin too big?
There is no specific limit. With loads of RAM on computers these days you can probably keep going. I must say that sounds fairly large, however.
Quote:
I am currently trying to figure out how to gsub out a bunch of words if a specific character is in that line.
I don't understand that. What do you mean by "gsub out a bunch of words if a specific character is in that line"? Can you give an example? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Wuggly
USA (112 posts) Bio
|
Date
| Reply #2 on Sat 09 Jul 2016 01:01 PM (UTC) Amended on Sat 09 Jul 2016 05:19 PM (UTC) by Wuggly
|
Message
| ie:
x4444 y255 z1958 > Wuggly says, 'hi'.
So since there is a >, I am wanting to remove the > and everything before it, but keep everything after it.
I have a capture all trigger, and am wanting to be able to accomplish this within the function that trigger uses.
I have considered making another trigger, like * > * putting the second wildcard into a global variable, then when the capture all trigger/function detects the >, I could probably manipulate the line by doing something like line = wildcardglobalvar.
Was hoping there is another way to do this within the function of the capture all trigger that's already in place.
This isn't a big issue, I am just trying to cut down/shave/optimize my code some by doing it this way. Cause if there is a way to accomplish this, I will be able to cut out many other triggers I have.
EDIT: Haha yes, it is quite large, however it is mostly for visual stuff. A good bulk of it is from an interactive new settings menu I built for it, that lets you customize everything you see.
Here's a screenshot, just ignore the description part of the Sidebar Background, really need to go back and change that. But this is with everything open. Each window can be closed, and are animated when closing/opening. With everything closed, all you see is an open button to pull the sidebar out.
http://i.imgur.com/zOufv70.png | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 10 Jul 2016 06:29 AM (UTC) |
Message
| A simple regexp will do that:
test = "x4444 y255 z1958 > Wuggly says, 'hi'."
foo = string.match (test, ".->(.*)")
print (foo) --> Wuggly says, 'hi'.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Sun 10 Jul 2016 07:56 AM (UTC) |
Message
|
Quote:
Here's a screenshot ...
Wow, MUSHclient scrubs up quite well, eh? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Wuggly
USA (112 posts) Bio
|
Date
| Reply #5 on Sun 10 Jul 2016 01:50 PM (UTC) |
Message
| As always, thank you again Nick! You've helped me get through roadblocks time and time again. So very much appreciated!
Just 6 months ago, I didn't know any Lua at all besides the very basic stuff that I learned when I first installed it (which was dec 25th last year) in order to make some aliases.
So that screenshot is proof how much of a help you and fiendish has been.
I hope one day to make a universal version of it so everyone can use it, but I still have a long list of things I plan to add to it before then.
Anyways, thanks again! | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
16,486 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top