-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathlib.lua
More file actions
44 lines (38 loc) · 882 Bytes
/
lib.lua
File metadata and controls
44 lines (38 loc) · 882 Bytes
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
function IsModChanged(data,modname)
if data
and data.mod_changes
and data.mod_changes[modname]
and data.mod_changes[modname].old_version then
return true
end
return false
end
function GetOldVersion(data,modname)
return FormatVersion(data.mod_changes[modname].old_version)
end
function GetNewVersion(data,modname)
return FormatVersion(data.mod_changes[modname].new_version)
end
function FormatVersion(version)
return string.format("%02d.%02d.%02d", string.match(version, "(%d+).(%d+).(%d+)"))
end
function table.contains(self,item)
for _,v in pairs(self) do
if v == item then
return true
elseif type(v) == "table" then
if table.contains(v,item) then
return true
end
end
end
return false
end
function table.count(self)
if self == nil or self == {} then return 0 end
local i = 0
for _ in pairs(self) do
i = i + 1
end
return i
end