aboutsummaryrefslogtreecommitdiff
path: root/string2.lua
diff options
context:
space:
mode:
Diffstat (limited to 'string2.lua')
-rw-r--r--string2.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/string2.lua b/string2.lua
index 09cb5ea..429ab7f 100644
--- a/string2.lua
+++ b/string2.lua
@@ -130,6 +130,12 @@ local string2 = {
end
return table.concat(lines, "\n")
end,
+ indented = function(self, indent)
+ if indent == nil then
+ indent = " "
+ end
+ return indent .. (gsub(self, "\n", "\n" .. indent))
+ end,
as_lua = function(self)
local escaped = gsub(self, "\\", "\\\\")
escaped = gsub(escaped, "\n", "\\n")