-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
46 lines (38 loc) · 1.09 KB
/
client.lua
File metadata and controls
46 lines (38 loc) · 1.09 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
local function addKey(id, data)
if type(id) ~= "string" then
error("bad argument #1 to 'addKey' (string expected, got " .. type(id) .. ")", 2)
end
if type(data) ~= 'table' or not data.key or not data.text then
error("bad argument #2 to 'addKey' (must have table with 'key' and 'text' fields)", 2)
end
SendNUIMessage({
action = "add",
id = id,
data = data
})
end
local function removeKey(id)
if type(id) ~= "string" then
error("bad argument #1 to 'removeKey' (string expected, got " .. type(id) .. ")", 2)
end
SendNUIMessage({
action = "remove",
id = id
})
end
local function editKey(key, data)
if type(key) ~= "string" then
error("bad argument #1 to 'editKey' (string expected, got " .. type(key) .. ")", 2)
end
if type(data) ~= 'table' or not data.key or not data.text then
error("bad argument #2 to 'editKey' (must have table with 'key' and 'text' fields)", 2)
end
SendNUIMessage({
action = "edit",
id = key,
data = data
})
end
exports('AddButton', addKey)
exports('RemoveButton', removeKey)
exports('EditButton', editKey)