Making borders of specific lengths without doing it manually

Posted by Rivius on Sun 30 Jan 2011 01:18 AM — 2 posts, 11,888 views.

#0
I wanted to make a function that does a few echos for me, but I want to border it with "~" or "-"'s.

For example, I have a string that says
STUNNED

but I want to output
~~~~~~~~~~~~~~~~~~~~~~~~~
[ STUNNED! ]
~~~~~~~~~~~~~~~~~~~~~~~~~

Is there a quick and easy way to repeat the "~" for the string length of "[ STUNNED! ]" so that I can throw this into a function?

Australia Forum Administrator #1

test = "[ STUNNED! ]"

print (string.rep ("~", #test))
print (test)
print (string.rep ("~", #test))