blob: b7f3a107a4be52ad0ccb4bb4a1effdeb89d4e3db (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
local ffi = require("ffi")
local os = ffi.os
local extension
if os == "Linux" then
extension = "so"
elseif os == "Windows" then
extension = "dll"
else
extension = "dylib"
end
ffi.cdef[[
int status(void);
]]
local C = ffi.load("target/debug/senpy_ffi." .. extension)
-- status
local c_status = C.status()
local status
if c_status == 1 then
status = "up"
elseif c_status == 0 then
status = "down"
elseif c_status == -1 then
status = "not down, but unreachable"
else
status = "unknown"
end
print("status: api.senpy.club is " .. status)
|