diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-08-22 14:56:30 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-08-22 15:15:40 +0200 |
commit | f2890cd4ab5f5e3fa8490e46229ec3b4a7d3e145 (patch) | |
tree | 332b1039da58953156dbc3be7b3597232cc3b2d6 /pingu.lua | |
parent | d3e49c4280f10584587fad83bc08c6a168c174d3 (diff) | |
download | pingu-f2890cd4ab5f5e3fa8490e46229ec3b4a7d3e145.tar.bz2 pingu-f2890cd4ab5f5e3fa8490e46229ec3b4a7d3e145.tar.xz |
lua: move lua files to separate subdir
Diffstat (limited to 'pingu.lua')
-rw-r--r-- | pingu.lua | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/pingu.lua b/pingu.lua deleted file mode 100644 index c29b276..0000000 --- a/pingu.lua +++ /dev/null @@ -1,49 +0,0 @@ - -module(..., package.seeall) - - -local function run_command(self, cmd) - self.handle:write(cmd.."\n") - self.handle:flush() - - local t = {} - local line = self.handle:read("*line") - while line ~= "" do - local key, value = string.match(line, "^(.*): (.*)$") - t[key] = value - line = self.handle:read("*line") - end - return t -end - -local function host_status(self) - return self:run_command("host-status") -end - -local function gateway_status(self) - return self:run_command("gateway-status") -end - -local function close(self) - return self.handle:close() -end - -function connect(socket_path) - local socket = require("pingu.client") - local fh, err - if socket ~= nil then - fh, err = socket.open(socket_path) - end - if fh == nil then - return fh, err - end - return { - ["handle"] = fh, - ["run_command"] = run_command, - ["host_status"] = host_status, - ["gateway_status"] = gateway_status, - ["close"] = close - } -end - - |