Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. function indent( message, nbrChar, first )
  2.    
  3.     local strTbl = string.Explode( "", message )
  4.  
  5.     for i=nbrChar,#strTbl,nbrChar do
  6.  
  7.         if strTbl[i] == " " then
  8.  
  9.             strTbl[i] = "\n"
  10.  
  11.         else
  12.  
  13.             for k=i,1,-1 do
  14.                
  15.                 if strTbl[k] == " " then
  16.  
  17.                     strTbl[k] = "\n"
  18.  
  19.                     break
  20.  
  21.                 end
  22.  
  23.            
  24.  
  25.             end
  26.  
  27.         end
  28.  
  29.     end
  30.    
  31.    
  32.     if first then
  33.         return string.Explode("\n", table.concat(strTbl))
  34.     else
  35.         return table.concat(strTbl)
  36.     end
  37.  
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement