Change sentence order from LTR to RTL

I’m trying to get a sentence in an RTL language, but it gets flipped and becomes left-to-right.
What I want the sentence to look like:

טקסט לדוגמא

What is being displayed:

לדוגמא טקסט

Video Example:

I’ve tried doing: string.reverse(), but it reverses each letter.

you can split the string, reverse it, and concatenate it again,

local content = ""
local reversedWords = {}
for _, word in ipairs(string.split(content, " ")) do
	table.insert(reversedWords, string.reverse(word))
end
local result = table.concat(reversedWords, " ")

It reveres each letter, not the order of the words, and makes some letters undefined.
image

Oh I misunderstood the question, this code will reverse the order of the words.

local content = ""
local reversedWords = {}
for _, word in ipairs(string.split(content, " ")) do
	table.insert(reversedWords, 1, word)
end
local result = table.concat(reversedWords, " ")
2 Likes

Thank you! It changed the order properly.