a = " test [[ hello ]] " a = a:gsub("%[%[", "\\[\\["):gsub("%]%]", "\\]\\]") a = "return [[" ..a .."]]" print(load(a)())