summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/util.lua b/util.lua
index bb9b2e8..157d7ad 100644
--- a/util.lua
+++ b/util.lua
@@ -49,4 +49,13 @@ function filter(a, pred)
end
end
return filtered
-end \ No newline at end of file
+end
+
+function fmt(x)
+ t = type(x)
+ if t == "number" then return "" .. x
+ elseif t == "string" then return x
+ elseif t == "boolean" and x then return "true"
+ elseif t == "boolean" and not x then return "false" end
+ return "NA"
+end