Add %20 between each word

Say I have
local word = “Hi friend”

How do I turn it into
Hi%20friend

word:gsub("%s", "%%20")

This replaces each space with %20, the extra % there is to escape the first, since % has a special meaning in string patterns.

Is there a guide on lua(u) formatting for strings, or is it similar to something like C or golang?

1 Like