-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.lua
More file actions
40 lines (33 loc) · 708 Bytes
/
utils.lua
File metadata and controls
40 lines (33 loc) · 708 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
function rndItem(table)
if table == nil then return nil end
return table[rnd(#table)]
end
function rndSelector(table)
return function()
return rndItem(table)
end
end
function inList(item, list)
for ind, val in ipairs(list) do
if val == item then
return true
end
end
return false
end
function rndExcept(max, exceptions)
local res = 0
repeat
res = rnd(max)
until not inList(res, exceptions)
return res
end
function updateStat(statTable)
local res = 0
for key, value in pairs(statTable) do
if value == true then
res = res + 1
end
end
statTable.count = res
end