aboutsummaryrefslogtreecommitdiffstats
path: root/lua/utils/simple.lua
blob: 637dcde70203ff9cae3a75a7ea7775d980411701 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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