aboutsummaryrefslogtreecommitdiffstats
path: root/lua/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lua/utils')
-rw-r--r--lua/utils/simple.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/lua/utils/simple.lua b/lua/utils/simple.lua
new file mode 100644
index 0000000..637dcde
--- /dev/null
+++ b/lua/utils/simple.lua
@@ -0,0 +1,22 @@
+local M = {}
+
+function M.lower(a, b)
+ if a > b then return b else return a end
+end
+
+function M.tablelength(T)
+ local c = 0
+ for _ in pairs(T) do c = c + 1 end
+ return c
+end
+
+function M.cmdcontent(cmd)
+ local b = {}
+ local a = io.popen(cmd, 'r')
+ if a == nil then return end
+ for _ in a:lines() do table.insert(b, _) end
+ a:close()
+ return b
+end
+
+return M