-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutil.lua
More file actions
52 lines (48 loc) · 1.25 KB
/
util.lua
File metadata and controls
52 lines (48 loc) · 1.25 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
47
48
49
50
51
52
function RegisterFrameworkCommand (name, handler, restricted)
if type(name) == 'table' then
for _, c in ipairs(name) do
RegisterFrameworkCommand(c, handler, restricted)
end
else
RegisterCommand(name, handler, restricted)
end
end
function RegisterCommandAlias (command, alias)
if type(alias) == 'table' then
for _, a in ipairs(alias) do
RegisterCommandAlias(command, a)
end
else
RegisterCommand(alias, function (source, args, raw)
ExecuteCommand(command .. ' ' .. table.concat(args, ' '))
end)
end
end
function RegisterCommandSuggestion(command, description, parameters, client)
if type(command) == 'table' then
for _, c in ipairs(command) do
RegisterCommandSuggestion(c, description, parameters)
end
else
TriggerEvent('chat:addSuggestion', '/' .. command, description, parameters)
end
end
function ContainsNonWhitespaceCharacter(string)
for i = 1, #string do
local char = string:sub(i,i)
if char ~= ' ' then
return true
end
end
return false
end
function ContainsSwear(str)
if type(Config.SwearFilter) == 'number' then
for _, pattern in ipairs(Config.SwearFilter) do
if str:gmatch(pattern) then
return true
end
end
end
return false
end