This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
utils.lua
59 lines (53 loc) · 1.45 KB
/
utils.lua
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
53
54
55
56
57
58
59
function clone(object)
local lookup_table = {}
local function copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for key, value in pairs(object) do
new_table[copy(key)] = copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return copy(object)
end
function MergeConfig(t1, t2)
local copy = clone(t1)
for k,v in pairs(t2) do
if type(v) == "table" then
if type(copy[k] or false) == "table" then
MergeConfig(copy[k] or {}, t2[k] or {})
else
copy[k] = v
end
else
copy[k] = v
end
end
return copy
end
function PrintError(msg)
-- ShowNotification("~r~RPROGRESS ERROR: ~w~" .. msg)
msg = "======== RPROGRESS ERROR: " .. msg .. " ========"
local s = string.rep("=", string.len(msg))
print(s)
print(msg)
print(s)
end
function LoadAnimDict(animDict)
if not HasAnimDictLoaded(animDict) then
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(1)
end
end
end
function ShowNotification(msg)
SetNotificationTextEntry('STRING')
AddTextComponentSubstringPlayerName(msg)
DrawNotification(false, true)
end