aboutsummaryrefslogtreecommitdiff
path: root/utils.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-09-24 20:20:43 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-09-24 20:20:43 -0700
commit8afab37c90416c5a6a6853df2e6976f26599f5c3 (patch)
tree5eb2e8bd26138ea55cbbdd4b458c01c196a7a74d /utils.lua
parentaf3274ca9237a08093009e87955e30ab5f473f12 (diff)
Recompiled.
Diffstat (limited to 'utils.lua')
-rw-r--r--utils.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/utils.lua b/utils.lua
index e058645..84a0b54 100644
--- a/utils.lua
+++ b/utils.lua
@@ -10,6 +10,15 @@ utils = {
end
return true
end,
+ size = function(t)
+ do
+ local n = 0
+ for _ in pairs(t) do
+ n = n + 1
+ end
+ return n
+ end
+ end,
repr = function(x)
local _exp_0 = type(x)
if 'table' == _exp_0 then
@@ -39,7 +48,9 @@ utils = {
end)(), ", ")) .. "}"
end
elseif 'string' == _exp_0 then
- if not x:find([["]]) and not x:find("\n") and not x:find("\\") then
+ if x == "\n" then
+ return "'\\n'"
+ elseif not x:find([["]]) and not x:find("\n") and not x:find("\\") then
return "\"" .. x .. "\""
elseif not x:find([[']]) and not x:find("\n") and not x:find("\\") then
return "\'" .. x .. "\'"