Add random_choice helper function to effect template
This commit is contained in:
@@ -35,3 +35,14 @@ function OnTick()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Add custom helper functions below.
|
-- Add custom helper functions below.
|
||||||
|
|
||||||
|
function random_choice(p1)
|
||||||
|
if type(p1) ~= "table" or #p1 == 0 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local choice = p1[math.random(#p1)]
|
||||||
|
return choice
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user