Thread Tools Display Modes
05-31-17, 07:26 AM   #1
rToothless
A Defias Bandit
Join Date: May 2017
Posts: 2
Post String Manipulation issue

Hey there.

I'm basically trying to make use of gsub or something like that to add spaces in long messages so they dont cut off with those stupid spaces(Basically inside of a messageframe where long messages puts huge gaps above and underneath it).
I've been thinking about using :len() and then grab the length and divide it on four.
Then somehow use the position to add a space, grab the first position add another 4th so its 2/4th add a new space and repeat. Now sure how to make that work through.
This would only be triggered if no spaces are found in the string at all.

tl;dr version: How can I find a specific length position inside of a string

I don't really have any code already made for this so nothing to share. Its meant to be forwarded into a messageframe and this simply so it doesn't add those annoying gaps above and underneath the message.
  Reply With Quote
05-31-17, 08:43 AM   #2
rToothless
A Defias Bandit
Join Date: May 2017
Posts: 2
A friend showed me a fix.


msg:gsub('(%S%S%S%S%S%S%S%S%S%S)', '%1 ')

That turns the message into 10 character segments.

add more "%S" for more characters
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » String Manipulation issue


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off