s:gsub(...)
does not affect s
, except when you do s=s:gsub(...)
. Try this:
s="hello"
print(s:gsub("[aeio]","-"))
print(s)
In Lua, all arguments are passed by value. There is no way to change the value of a variable from within a function. (You can change the contents of a table, but not the table itself.)