Created
September 23, 2019 21:33
-
-
Save fireundubh/72950d8de51fd44c3bc916e25ec3fc94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local percentCompleted = 0; | |
if isComplete then | |
percentCompleted = 1; | |
else | |
-- check for nil | |
if objectives then | |
for i, objective in pairs(objectives) do | |
-- check for nil | |
if objective and objective.numFulfilled and objective.numRequired then | |
percentCompleted = percentCompleted + (objective.numFulfilled / objective.numRequired); | |
end | |
end | |
percentCompleted = percentCompleted / table.getn(objectives); | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment