-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathshared.lua
52 lines (43 loc) · 949 Bytes
/
shared.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
Weapons = {}
WeaponHashes = {}
Filter = {}
function DumpTable(table, nb)
if nb == nil then
nb = 0
end
if type(table) == 'table' then
local s = ''
for i = 1, nb + 1, 1 do
s = s .. " "
end
s = '{\n'
for k,v in pairs(table) do
if type(k) ~= 'number' then k = '"'..k..'"' end
for i = 1, nb, 1 do
s = s .. " "
end
s = s .. '['..k..'] = ' .. DumpTable(v, nb + 1) .. ',\n'
end
for i = 1, nb, 1 do
s = s .. " "
end
return s .. '}'
else
return tostring(table)
end
end
local function data(name)
local file = ('data/%s.lua'):format(name)
local datafile = LoadResourceFile('ox_inventory', file)
local func, err = load(datafile, ('@@%s/%s'):format('ox_inventory', file))
if not func or err then
return print(err)
end
return func()
end
for k, v in pairs(data('weapons').Weapons) do
Weapons[#Weapons+1] = k
WeaponHashes[k] = true
Filter[k] = true
end
Filter[Config.repairItem] = true