Jump to content




Sentence/Text/Word to chars.


  • You cannot reply to this topic
2 replies to this topic

#1 LeDark Lua

  • Members
  • 369 posts
  • LocationLeLua

Posted 30 July 2015 - 11:46 AM

So i have this text:
This is an awesome text.
And I want it to change into:
Spoiler

Thanks in advance.

Edited by LeDark Lua, 30 July 2015 - 11:50 AM.


#2 Lignum

  • Members
  • 558 posts

Posted 30 July 2015 - 12:08 PM

You could do this:
local str = "Test"
local chars = {}

for i=1,#str do
   chars[#chars + 1] = str:sub(i, i)
end

return chars

To reverse it, use table.concat:
return table.concat(chars)


#3 LeDark Lua

  • Members
  • 369 posts
  • LocationLeLua

Posted 30 July 2015 - 12:10 PM

Thanks.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users