FreeKill/lua/client/client.lua

22 lines
587 B
Lua
Raw Normal View History

local Client = class('Client')
freekill.client_callback = {}
function Client:initialize()
self.client = freekill.ClientInstance
2022-03-02 12:56:37 +00:00
self.notifyUI = function(self, command, jsonData)
freekill.Backend:emitNotifyUI(command, jsonData)
end
2022-03-02 12:56:37 +00:00
self.client.callback = function(_self, command, jsonData)
local cb = freekill.client_callback[command]
if (type(cb) == "function") then
2022-03-02 12:56:37 +00:00
cb(jsonData)
else
2022-03-02 12:56:37 +00:00
self:notifyUI(command, jsonData);
end
end
end
-- Create ClientInstance (used by Lua)
ClientInstance = Client:new()